Crash on entity death due to null DamageSource in onLivingDeathEvent (v1.1.6 - Minecraft 1.21.1)
Closed this issue ยท 2 comments
๐ Bug Report
My dedicated server is crashing when an entity dies due to a NullPointerException in the onLivingDeathEvent method from cataclysm_spellbooks.
๐ Crash Details
Crash message:
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.damagesource.DamageSource.is(net.minecraft.tags.TagKey)" because "damageSource" is null at net.acetheeldritchking.cataclysm_spellbooks.events.ServerEvents.onLivingDeathEvent(ServerEvents.java:355)
Mod version: cataclysm_spellbooks-1.1.6-1.21
Minecraft version: 1.21.1
Forge/NeoForge version: NeoForge 21.1.145
Other relevant mods: irons_spellbooks, cobblemon, twilightforest, mynethersdelight
๐งช Reproduction
The crash seems to happen:
- When casting the spell
TectonicTrembleSpellfrom Cataclysm Spellbooks - And a mob dies to an unusual damage source (possibly custom ones from other mods)
๐ Additional Info
It looks like the mod is not checking whether damageSource is null before calling .is(...), which causes the crash.
Suggested fix:
Add a null check to onLivingDeathEvent before interacting with the damageSource.
๐ Crash Log
You can view the crash log here:
https://pastebin.com/FEGpPtHD
Let me know if youโd like a test world or modpack to reproduce it. Thanks for your awesome work on the mod!
I also just had a player cause a crash on my server with the same error message, still trying to figure out what spell might have been cast. But I can not replicate it with Tectonic Tremble in singleplayer, neither with the scroll nor the Flambege. Here's my log in case that helps.
We can't really tell if it's a specific spell, or any spell, or something else related to Cataclysm Spellbooks, but it keeps crashing my server every now and then. It's always the same error message java.lang.NullPointerException: Cannot invoke "net.minecraft.world.damagesource.DamageSource.is(net.minecraft.tags.TagKey)" because "damageSource" is null