Skip to content

Commit

Permalink
Fix drain-comparator NPE when the controller gets broken #1586
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed May 2, 2015
1 parent 9f0349c commit 129fb75
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -190,6 +190,11 @@ public int comparatorStrength ()
if(master == null)
return 0;
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(master.x, master.y, master.z);

// this can happen when the comparator checks its strength before the drain is getting updated on a broken master (smeltery controller)
if(smeltery == null)
return 0;

if(smeltery.maxLiquid == 0)
return 0;
return 15 * smeltery.currentLiquid / smeltery.maxLiquid;
Expand Down

0 comments on commit 129fb75

Please sign in to comment.