DEADSOFTWARE

Fix NPE on destroying background blocks
authorfred-boy <fred-boy@protonmail.com>
Thu, 12 Apr 2018 14:29:30 +0000 (21:29 +0700)
committerfred-boy <fred-boy@protonmail.com>
Thu, 12 Apr 2018 14:29:30 +0000 (21:29 +0700)
core/src/ru/deadsoftware/cavecraft/game/GameWorld.java

index 7c117b4bbb8ec6957256aadb80739fc6e7ac2e22..c32bbd9358f297088f28c43572154652520b919c 100644 (file)
@@ -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);
     }
 
 }