From 67750c582257596603bc0728da19580a014b5fe2 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:41:58 +0200 Subject: [PATCH] fix fluid pipes converting an empty fluidstack to an (illegal) null (#1010) --- .../gtceu/common/pipelike/fluidpipe/PipeTankList.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java index 48d3a4fef1..132c14739f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java @@ -159,13 +159,13 @@ public void restoreFromSnapshot(Object snapshot) { @Nullable @Override public FluidStack drain(FluidStack fluidStack, boolean doDrain) { - if (fluidStack == null || fluidStack.getAmount() <= 0) return null; + if (fluidStack.isEmpty() || fluidStack.getAmount() <= 0) return FluidStack.empty(); fluidStack = fluidStack.copy(); for (FluidStorage tank : tanks) { FluidStack drained = tank.drain(fluidStack, doDrain); if (!drained.isEmpty()) return drained; } - return null; + return FluidStack.empty(); } @Override