DEADSOFTWARE

Fix NPE after loading game
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / GameRenderer.java
index 648e785e8d07a96c9de6728124be0bcaac3013a8..38c79f1641b3e335ab2838ba80a873d58998fa03 100644 (file)
@@ -54,7 +54,7 @@ public class GameRenderer extends Renderer {
         if (maxY>gameProc.world.getHeight()) maxY = gameProc.world.getHeight();
         for (int y=minY; y<maxY; y++) {
             for (int x=minX; x<maxX; x++) {
-                if (gameProc.world.getForeMap(x,y)>0) {
+                if (gameProc.world.getForeMap(x,y)>0 && !Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x,y)).background) {
                     spriteBatch.draw(
                             Assets.blockTextures[Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x,y)).getTexture()],
                             x * 16 - camera.position.x,y * 16 - camera.position.y);