From 381f96a8c4b016a428a129cff22c43f3552167f1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 18 Feb 2022 13:55:03 -0500 Subject: [PATCH] v1.2.0: fixed null pointer crashes if the hero is right-clicked --- .../shatteredpixeldungeon/scenes/GameScene.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 2624052d5..30617471e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -1384,6 +1384,9 @@ public class GameScene extends PixelScene { } else if (objects.size() > 1){ title = "Multiple Objects"; image = Icons.get(Icons.INFO); + } else if (objects.get(0) instanceof Hero) { + title = textLines.remove(0); + image = new Image(((Hero) objects.get(0)).sprite); } else if (objects.get(0) instanceof Mob) { title = textLines.remove(0); image = new Image(((Mob) objects.get(0)).sprite); @@ -1401,6 +1404,8 @@ public class GameScene extends PixelScene { //determine first text line if (objects.isEmpty()) { textLines.add(0, "Go Here"); + } else if (objects.get(0) instanceof Hero) { + textLines.add(0, "Go Here"); } else if (objects.get(0) instanceof Mob) { if (((Mob) objects.get(0)).alignment != Char.Alignment.ENEMY) { textLines.add(0, "Interact");