From 62e6b5a336688680904edbfd4a7496e2808f3f0b Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Fri, 22 Oct 2021 02:13:17 +0900 Subject: [PATCH 1/2] guard lua_close() nhl_done() can be called with L == NULL. So lua_close() should be guarded. --- src/nhlua.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nhlua.c b/src/nhlua.c index 92a942b92..db4deb6c4 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -1375,7 +1375,8 @@ nhl_init(void) void nhl_done(lua_State *L) { - lua_close(L); + if (L) + lua_close(L); iflags.in_lua = FALSE; } From 090f1fb029800b76742dc669b0c599ec46ee447d Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 21 Oct 2021 13:34:21 -0400 Subject: [PATCH 2/2] check for NULL Lua_State prior to lua_close() fixes #616 --- doc/fixes37.0 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 35d1952c5..0e40ac4ac 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1314,6 +1314,7 @@ MAX_RADIUS defines the outer bound of the radius table, so leave it at 15 (pr #613 by argrath) variable attknum was declared without initialization, and was used in find_roll_to_hit() (pr #615 by argrath) +check for NULL lua_State before calling lua_close() (pr #616 by argrath) Code Cleanup and Reorganization