From 3b30bdca186cebb4ab43f5dcbbb23f1ca2ca205f Mon Sep 17 00:00:00 2001 From: Evan Debenham <Evan.SHPX@gmail.com> Date: Sun, 11 Jun 2017 04:45:22 -0400 Subject: [PATCH] v0.6.0b: added safety checks to floating text --- .../shatteredpixeldungeon/effects/FloatingText.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java index 30ae83deb..8adf2ac93 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java @@ -21,9 +21,9 @@ package com.shatteredpixel.shatteredpixeldungeon.effects; -import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; +import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; import com.watabou.noosa.RenderedText; @@ -100,13 +100,18 @@ public class FloatingText extends RenderedText { /* STATIC METHODS */ public static void show( float x, float y, String text, int color ) { - GameScene.status().reset( x, y, text, color ); + FloatingText txt = GameScene.status(); + if (txt != null){ + txt.reset(x, y, text, color); + } } public static void show( float x, float y, int key, String text, int color ) { FloatingText txt = GameScene.status(); - txt.reset( x, y, text, color ); - push( txt, key ); + if (txt != null) { + txt.reset(x, y, text, color); + push(txt, key); + } } private static void push( FloatingText txt, int key ) {