diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisarmingTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisarmingTrap.java index c332709de..1ccdc21d2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisarmingTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisarmingTrap.java @@ -50,11 +50,15 @@ public class DisarmingTrap extends Trap{ Heap heap = Dungeon.level.heaps.get( pos ); if (heap != null && heap.type == Heap.Type.HEAP){ - int cell = Dungeon.level.randomRespawnCell( null ); - Item item = heap.pickUp(); + int cell; + do { + cell = Dungeon.level.randomRespawnCell(null); + } while (cell != -1 && Dungeon.level.heaps.get( pos ) != null + && Dungeon.level.heaps.get( pos ).type != Heap.Type.HEAP); if (cell != -1) { + Item item = heap.pickUp(); Heap dropped = Dungeon.level.drop( item, cell ); dropped.seen = true; if (item instanceof Honeypot.ShatteredPot){