v0.6.0b: added safety checks to floating text

This commit is contained in:
Evan Debenham 2017-06-11 04:45:22 -04:00
parent 61f4a909c5
commit 3b30bdca18

View File

@ -21,9 +21,9 @@
package com.shatteredpixel.shatteredpixeldungeon.effects; package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.noosa.Camera; import com.watabou.noosa.Camera;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.RenderedText; import com.watabou.noosa.RenderedText;
@ -100,13 +100,18 @@ public class FloatingText extends RenderedText {
/* STATIC METHODS */ /* STATIC METHODS */
public static void show( float x, float y, String text, int color ) { 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 ) { public static void show( float x, float y, int key, String text, int color ) {
FloatingText txt = GameScene.status(); FloatingText txt = GameScene.status();
txt.reset( x, y, text, color ); if (txt != null) {
push( txt, key ); txt.reset(x, y, text, color);
push(txt, key);
}
} }
private static void push( FloatingText txt, int key ) { private static void push( FloatingText txt, int key ) {