diff --git a/src/pc/network/packets/packet_lua_custom.c b/src/pc/network/packets/packet_lua_custom.c index a61d690c2..618524943 100644 --- a/src/pc/network/packets/packet_lua_custom.c +++ b/src/pc/network/packets/packet_lua_custom.c @@ -11,6 +11,11 @@ void network_send_lua_custom(bool broadcast) { u16 zero = 0; s32 paramIndex = 1; + if (!L) { + LOG_ERROR("Sent lua custom packet when lua is dead"); + return; + } + // figure out mod index if (gLuaActiveMod == NULL) { LOG_LUA_LINE("Could not figure out the current active mod!"); @@ -99,6 +104,11 @@ void network_receive_lua_custom(struct Packet* p) { packet_read(p, &modIndex, sizeof(u16)); packet_read(p, &keyCount, sizeof(u8)); + if (!L) { + LOG_ERROR("Received lua custom packet when lua is dead"); + return; + } + lua_newtable(L); s32 tableIndex = lua_gettop(L); for(u16 i = 0; i < keyCount; i++) {