Lemmmy / JRogue

Roguelike dungeon crawler written in Java
MIT License
3 stars 0 forks source link

Spellbooks spawned on the first level cause a crash #95

Open Lemmmy opened 7 years ago

Lemmmy commented 7 years ago
java.lang.NullPointerException: null
    at jr.dungeon.items.magical.ItemSpellbook.lambda$onSpawnInChest$6(ItemSpellbook.java:248) ~[main/:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) ~[?:1.8.0_121]
    at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1691) ~[?:1.8.0_121]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_121]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_121]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_121]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_121]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_121]
    at jr.dungeon.items.magical.ItemSpellbook.onSpawnInChest(ItemSpellbook.java:252) ~[main/:?]
    at jr.dungeon.generators.rooms.features.FeatureChest.populateChestItem(FeatureChest.java:121) ~[main/:?]
    at jr.dungeon.generators.rooms.features.FeatureChest.populateChest(FeatureChest.java:94) ~[main/:?]
    at jr.dungeon.generators.rooms.features.FeatureChest.generate(FeatureChest.java:72) ~[main/:?]
    at jr.dungeon.generators.GeneratorRooms.addRoomFeatures(GeneratorRooms.java:483) ~[main/:?]
    at jr.dungeon.generators.GeneratorRooms.generate(GeneratorRooms.java:221) ~[main/:?]
    at jr.dungeon.generators.GeneratorStandard.generate(GeneratorStandard.java:57) ~[main/:?]
    at jr.dungeon.Level.generate(Level.java:118) ~[main/:?]
    at jr.dungeon.Dungeon.generateFirstLevel(Dungeon.java:163) ~[main/:?]
    at jr.dungeon.Dungeon.load(Dungeon.java:404) ~[main/:?]
    at jr.rendering.screens.CharacterCreationScreen$3.changed(CharacterCreationScreen.java:183) ~[main/:?]
    at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:182) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:147) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:124) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.ui.Button$1.clicked(Button.java:92) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:58) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:353) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.InputMultiplexer.touchUp(InputMultiplexer.java:96) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.InputEventQueue.drain(InputEventQueue.java:81) ~[gdx-1.9.6.jar:?]
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Input.update(Lwjgl3Input.java:178) ~[gdx-backend-lwjgl3-1.9.6.jar:?]
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:377) ~[gdx-backend-lwjgl3-1.9.6.jar:?]
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:136) ~[gdx-backend-lwjgl3-1.9.6.jar:?]
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:110) ~[gdx-backend-lwjgl3-1.9.6.jar:?]
    at jr.JRogue.<init>(JRogue.java:117) [main/:?]

It's caused by Player being null

Lemmmy commented 7 years ago

Side note: spell books don't spawn that often