
NullPointerException when script is reloaded at the same time as an event is fired
ljfa-ag opened this issue ยท 0 comments
Minecraft Version
1.21.1
KubeJS Version
2101.7.2-build.233
Rhino Version
2101.2.7-build.74
Architectury Version
none
Forge/Fabric Version
NeoForge 21.1.1
Describe your issue
It seems like I managed to use the /reload command at just the right time that the extraEventContainers != null
check in this line has returned true, but the subsequent access to extraEventContainers.containsKey(extraId)
has failed since extraEventContainers has been set to null in the meantime by the script unload. Notice how the NPE happened in the Render thread, while the reload was happening in the Server thread.
This appears to be a rather rare race condition, the crash only happened once so far and I haven't been able to reproduce it even with a repeating command block calling /reload hundreds of times back to back.
This particular NPE should be fixable by moving the access to extraEventContainers in hasListeners to a local variable, or by using an empty map rather than null if extraEventContainers is not used.
Crash report and debug.log:
crash-2025-07-27_22.19.14-client.txt
debug.log
Crash report/logs
No response