From 5c881642110f646f462674ef2aa39442cc81dc68 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 11 Apr 2015 17:38:15 -0400 Subject: [PATCH] And handle the null case in the constructor itself. Closes #1794 (again) --- src/main/java/net/minecraftforge/fluids/FluidStack.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fluids/FluidStack.java b/src/main/java/net/minecraftforge/fluids/FluidStack.java index 962633149..c18e18e70 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidStack.java +++ b/src/main/java/net/minecraftforge/fluids/FluidStack.java @@ -23,7 +23,12 @@ public class FluidStack public FluidStack(Fluid fluid, int amount) { - if (!FluidRegistry.isFluidRegistered(fluid)) + if (fluid == null) + { + FMLLog.bigWarning("Null fluid supplied to fluidstack. Did you try and create a stack for an unregistered fluid?"); + throw new IllegalArgumentException("Cannot create a fluidstack from a null fluid"); + } + else if (!FluidRegistry.isFluidRegistered(fluid)) { FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName()); throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");