Skip to content

Commit

Permalink
Fix crash from invalid canFill/Drain calls. #1042
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Sep 29, 2014
1 parent e658348 commit 6ca11c5
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -105,12 +105,17 @@ public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
@Override
public boolean canFill (ForgeDirection from, Fluid fluid)
{
if(fluid == null)
return false;
return fill(from, new FluidStack(fluid, 1), false) > 0;
}

@Override
public boolean canDrain (ForgeDirection from, Fluid fluid)
{
if(fluid == null)
return false;

FluidStack drained = drain(from, new FluidStack(fluid, 1), false);
return drained != null && drained.amount > 0;
}
Expand Down

0 comments on commit 6ca11c5

Please sign in to comment.