v0.9.1c: added various safety checks to prevent crashes

This commit is contained in:
Evan Debenham 2021-01-10 15:18:11 -05:00
parent 0cec93ade6
commit 8fafe2af57
3 changed files with 4 additions and 3 deletions

View File

@ -154,7 +154,7 @@ public class RingOfWealth extends Ring {
private static int latestDropTier = 0; private static int latestDropTier = 0;
public static void showFlareForBonusDrop( Visual vis ){ public static void showFlareForBonusDrop( Visual vis ){
if (vis == null) return; if (vis == null || vis.parent == null) return;
switch (latestDropTier){ switch (latestDropTier){
default: default:
break; //do nothing break; //do nothing

View File

@ -173,7 +173,7 @@ public class GameScene extends PixelScene {
@Override @Override
public void create() { public void create() {
if (Dungeon.hero == null){ if (Dungeon.hero == null || Dungeon.level == null){
ShatteredPixelDungeon.switchNoFade(TitleScene.class); ShatteredPixelDungeon.switchNoFade(TitleScene.class);
return; return;
} }

View File

@ -214,7 +214,8 @@ public class PixelScene extends Scene {
banner.camera = uiCamera; banner.camera = uiCamera;
banner.x = align( banner.camera, (banner.camera.width - banner.width) / 2 ); banner.x = align( banner.camera, (banner.camera.width - banner.width) / 2 );
banner.y = align( banner.camera, (banner.camera.height - banner.height) / 3 ); banner.y = align( banner.camera, (banner.camera.height - banner.height) / 3 );
Game.scene().add( banner ); Scene s = Game.scene();
if (s != null) s.add( banner );
} }
protected static class Fader extends ColorBlock { protected static class Fader extends ColorBlock {