summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2018-07-11 01:45:20 +0300
committerdartraiden <wowemuh@gmail.com>2018-07-11 01:45:20 +0300
commit1886d6594c2c45208fca9bb9537185eb63e94df4 (patch)
tree62b010b78b5b1b339bf750af83d1e9c3ef9c1058
parent431b632ec24f13356397323f19d0db4d117c793f (diff)
fix regression, introduced in dae1e12d0bc0be3b6c243dc624b30e1ed3b07410
-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);