#2584 don't crash on empty fluid containers

This commit is contained in:
Matthias Mann committed 2015-06-14 22:29:38 +02:00
1 parent b6f67c57e3
commit ae2c783e1e
1 file changed
+2 -1
+2 -1
View File
@@ -250,7 +250,8 @@ public class FluidUtil {
if (source != null && source.getItem() != null) {
if (source.getItem() instanceof IFluidContainerItem) {
IFluidTank targetTank = tank.getInputTank(((IFluidContainerItem) source.getItem()).getFluid(source));
FluidStack fluid = ((IFluidContainerItem) source.getItem()).getFluid(source);
IFluidTank targetTank = fluid != null ? tank.getInputTank(fluid) : null;
if (targetTank != null) {
FluidStack target = targetTank.getFluid();
int maxDrain = targetTank.getCapacity() - (target != null ? target.amount : 0);