diff --git a/src/logic/scripting/scripting.cpp b/src/logic/scripting/scripting.cpp index 9a6cc115..fb3e7a84 100644 --- a/src/logic/scripting/scripting.cpp +++ b/src/logic/scripting/scripting.cpp @@ -351,7 +351,7 @@ static bool on_block_common( result = lua::emit_event(lua::get_main_state(), name, [pos, player](auto L) { lua::pushivec_stack(L, pos); - lua::pushinteger(L, player->getId()); + lua::pushinteger(L, player ? player->getId() : -1); return 4; }); }