From: fred-boy Date: Thu, 12 Apr 2018 14:29:30 +0000 (+0700) Subject: Fix NPE on destroying background blocks X-Git-Tag: alpha0.1~9 X-Git-Url: https://deadsoftware.ru/gitweb?p=cavedroid.git;a=commitdiff_plain;h=c21d1b3fed19f8de8a0fbc558f96541b1f2c8a05 Fix NPE on destroying background blocks --- 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); } }