summaryrefslogtreecommitdiff
path: root/libs/liblua/src/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/liblua/src/lstate.c')
-rw-r--r--libs/liblua/src/lstate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libs/liblua/src/lstate.c b/libs/liblua/src/lstate.c
index c1a76643c3..8815afb95f 100644
--- a/libs/liblua/src/lstate.c
+++ b/libs/liblua/src/lstate.c
@@ -339,6 +339,9 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
LUA_API void lua_close (lua_State *L) {
+ if (!L)
+ return;
+
L = G(L)->mainthread; /* only the main thread can be closed */
lua_lock(L);
close_state(L);