diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java index eed3dbfe6..ece3972ed 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java @@ -130,7 +130,9 @@ public class Bones { Bundle bundle = FileUtils.bundleFromFile(BONES_FILE); depth = bundle.getInt( LEVEL ); - item = (Item)bundle.get( ITEM ); + if (depth > 0) { + item = (Item) bundle.get(ITEM); + } return get(); @@ -141,7 +143,13 @@ public class Bones { } else { //heroes who are challenged cannot find bones if (depth == Dungeon.depth && Dungeon.challenges == 0) { - FileUtils.deleteFile( BONES_FILE ); + Bundle emptyBones = new Bundle(); + emptyBones.put(LEVEL, 0); + try { + FileUtils.bundleToFile( BONES_FILE, emptyBones ); + } catch (IOException e) { + ShatteredPixelDungeon.reportException(e); + } depth = 0; if (item == null) return null;