diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 5215e6b38..11da6354a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -18,6 +18,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import java.util.Collection; +import java.util.Collections; import java.util.LinkedList; import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; @@ -340,7 +341,8 @@ public class Heap implements Bundlable { public void restoreFromBundle( Bundle bundle ) { pos = bundle.getInt( POS ); type = Type.valueOf( bundle.getString( TYPE ) ); - items = new LinkedList( (Collection) bundle.getCollection( ITEMS ) ); + items = new LinkedList( (Collection) bundle.getCollection( ITEMS ) ); + items.removeAll(Collections.singleton(null)); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 4e215f86f..68e92dc2b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -253,7 +253,8 @@ public abstract class Level implements Bundlable { if (resizingNeeded) { heap.pos = adjustPos( heap.pos ); } - heaps.put( heap.pos, heap ); + if (!heap.isEmpty()) + heaps.put( heap.pos, heap ); } collection = bundle.getCollection( PLANTS );