Fixed NPE in Tank Triggers

This commit is contained in:
CovertJaguar 2012-07-30 12:12:39 -07:00
parent bc11ac7b52
commit 7e9f61eeb2

View file

@ -86,7 +86,7 @@ public class TriggerLiquidContainer extends Trigger {
if (liquids != null && liquids.length > 0) { if (liquids != null && liquids.length > 0) {
for (ILiquidTank c : liquids) for (ILiquidTank c : liquids)
if (c.getLiquid().amount != 0) if (c.getLiquid() != null && c.getLiquid().amount != 0)
return false; return false;
return true; return true;
@ -94,7 +94,7 @@ public class TriggerLiquidContainer extends Trigger {
return false; return false;
case Contains: case Contains:
for (ILiquidTank c : liquids) for (ILiquidTank c : liquids)
if (c.getLiquid().amount != 0) if (c.getLiquid() != null && c.getLiquid().amount != 0)
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID) if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID)
return true; return true;
@ -102,7 +102,7 @@ public class TriggerLiquidContainer extends Trigger {
case Space: case Space:
for (ILiquidTank c : liquids) for (ILiquidTank c : liquids)
if (c.getLiquid().amount == 0) if (c.getLiquid() == null || c.getLiquid().amount == 0)
return true; return true;
else if (c.getLiquid().amount < c.getCapacity()) else if (c.getLiquid().amount < c.getCapacity())
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID) if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID)
@ -111,7 +111,7 @@ public class TriggerLiquidContainer extends Trigger {
return false; return false;
case Full: case Full:
for (ILiquidTank c : liquids) for (ILiquidTank c : liquids)
if (c.getLiquid().amount < c.getCapacity()) if (c.getLiquid() == null || c.getLiquid().amount < c.getCapacity())
return false; return false;
return true; return true;