From c21d1b3fed19f8de8a0fbc558f96541b1f2c8a05 Mon Sep 17 00:00:00 2001 From: fred-boy Date: Thu, 12 Apr 2018 21:29:30 +0700 Subject: [PATCH] Fix NPE on destroying background blocks --- core/src/ru/deadsoftware/cavecraft/game/GameWorld.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java index 7c117b4..c32bbd9 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java @@ -67,8 +67,8 @@ public class GameWorld { } public void placeToBackground(int x, int y, int value) { - if ((getBackMap(x,y) == 0 || value == 0) && - !Items.BLOCKS.getValueAt(value).foreground) setBackMap(x,y,value); + if (value==0 || (getBackMap(x,y) == 0 && !Items.BLOCKS.getValueAt(value).foreground)) + setBackMap(x,y,value); } } -- 2.29.2