And handle the null case in the constructor itself. Closes #1794 (again)

This commit is contained in:
cpw 2015-04-11 17:38:15 -04:00
parent 230d757a89
commit 5c88164211

View file

@ -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");