Further prevent nullpointer errors

This commit is contained in:
AlexTheCoder 2016-07-03 04:11:14 -04:00
parent d0a8ee18c0
commit af9d91faa8

View File

@ -174,7 +174,8 @@ public class BlockRestore extends MiniPlugin
//Fill Above //Fill Above
if (((block.getTypeId() == 78 && block.getData() >= (byte)7) || block.getTypeId() == 80) && getData(block) != null) if (((block.getTypeId() == 78 && block.getData() >= (byte)7) || block.getTypeId() == 80) && getData(block) != null)
{ {
getData(block).update(78, heightAdd, expireTime, meltDelay); if (getData(block) != null)
getData(block).update(78, heightAdd, expireTime, meltDelay);
if (heightJumps > 0) snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, heightJumps - 1); if (heightJumps > 0) snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, heightJumps - 1);
if (heightJumps == -1) snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -1); if (heightJumps == -1) snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -1);
@ -219,8 +220,11 @@ public class BlockRestore extends MiniPlugin
//Snow //Snow
if (!contains(block)) if (!contains(block))
getBlocks().put(block, new BlockRestoreData(block, 78, (byte) Math.max(0, heightAdd - 1), block.getTypeId(), block.getData(), expireTime, meltDelay, false)); getBlocks().put(block, new BlockRestoreData(block, 78, (byte) Math.max(0, heightAdd - 1), block.getTypeId(), block.getData(), expireTime, meltDelay, false));
else else
getData(block).update(78, heightAdd, expireTime, meltDelay); {
if (getData(block) != null)
getData(block).update(78, heightAdd, expireTime, meltDelay);
}
} }
public boolean contains(Block block) public boolean contains(Block block)