Fixed NPE when events are triggered within events (#1574)

This commit is contained in:
replaceitem authored and GitHub committed 2022-10-16 17:33:54 +02:00
1 parent ab9f7992b7
commit 2b5e51b4df
1 file changed
+2 -1
@@ -223,7 +223,7 @@ public class CarpetEventServer
{
if (callList.size() > 0 && CarpetServer.scriptServer != null)
{
return CarpetServer.scriptServer.events.handleEvents.runIfEnabled( () -> {
Boolean isCancelled = CarpetServer.scriptServer.events.handleEvents.runIfEnabled( () -> {
CarpetProfiler.ProfilerToken currentSection = CarpetProfiler.start_section(null, "Scarpet events", CarpetProfiler.TYPE.GENERAL);
List<Value> argv = argumentSupplier.get(); // empty for onTickDone
CommandSourceStack source;
@@ -266,6 +266,7 @@ public class CarpetEventServer
CarpetProfiler.end_current_section(currentSection);
return cancelled;
});
return isCancelled != null && isCancelled;
}
return false;
}