From 996e47008935054f5cf90aa641e7cc5c2ab942ed Mon Sep 17 00:00:00 2001 From: jedk1 Date: Tue, 3 May 2016 23:03:50 +0100 Subject: [PATCH] Fix NPEs --- .../projectkorra/waterbending/IceSpikeBlast.java | 3 +++ .../projectkorra/waterbending/SurgeWall.java | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java index 37d17d25..d5192e3c 100644 --- a/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java @@ -240,6 +240,9 @@ public class IceSpikeBlast extends IceAbility { destination = target.getEyeLocation(); } + if (sourceBlock == null) { + return; + } location = sourceBlock.getLocation(); if (destination.distanceSquared(location) < 1) { return; diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java index 61719f94..5a4ed1a5 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java @@ -341,13 +341,15 @@ public class SurgeWall extends WaterAbility { } private static void finalRemoveWater(Block block) { - if (AFFECTED_BLOCKS.containsKey(block)) { - TempBlock.revertBlock(block, Material.AIR); - AFFECTED_BLOCKS.remove(block); - } - if (WALL_BLOCKS.containsKey(block)) { - TempBlock.revertBlock(block, Material.AIR); - WALL_BLOCKS.remove(block); + if (block != null) { + if (AFFECTED_BLOCKS.containsKey(block)) { + TempBlock.revertBlock(block, Material.AIR); + AFFECTED_BLOCKS.remove(block); + } + if (WALL_BLOCKS.containsKey(block)) { + TempBlock.revertBlock(block, Material.AIR); + WALL_BLOCKS.remove(block); + } } }