From 873d6a9537f90b7628bcaa33d4d972529fed9e69 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Thu, 3 Jul 2014 19:08:58 +0300 Subject: [PATCH] Eluna fix crash on shutdown, closes #71 --- LuaEngine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LuaEngine.cpp b/LuaEngine.cpp index 3526273..861351a 100644 --- a/LuaEngine.cpp +++ b/LuaEngine.cpp @@ -44,6 +44,7 @@ void Eluna::Initialize() void Eluna::Uninitialize() { delete GEluna; + GEluna = NULL; lua_scripts.clear(); lua_extensions.clear(); } @@ -241,6 +242,8 @@ void Eluna::RunScripts() void Eluna::RemoveRef(const void* obj) { + if (!sEluna) + return; lua_rawgeti(sEluna->L, LUA_REGISTRYINDEX, sEluna->userdata_table); lua_pushfstring(sEluna->L, "%p", obj); lua_gettable(sEluna->L, -2);