aboutsummaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorame <[email protected]>2025-12-01 21:12:42 -0600
committerame <[email protected]>2025-12-01 21:12:42 -0600
commit5ea12787f87f3ea60935b7a1f5b24be80cb2dec6 (patch)
treeb3083c5b7cad5fa58288c0dfd6b77d6b5677eacd /src/thread.c
parenta7caf5e9f4ca1cfddafaf5880d7ee2020e3c1578 (diff)
minor net changes, prevent buffer indexing evil metatables
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/thread.c b/src/thread.c
index f166c3f..a5f5cc2 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -391,8 +391,10 @@ int _buffer_mod(lua_State* L){
luaI_deepcopy(L, buffer->L, STRIP_GC | SKIP_LOCALS);
lua_getmetatable(L, idx);
- idx = lua_gettop(L);
- luaI_tsetnil(L, idx, "__gc");
+ if(lua_type(L, -1) == LUA_TTABLE){
+ idx = lua_gettop(L);
+ luaI_tsetnil(L, idx, "__gc");
+ }
}
pthread_mutex_unlock(&*buffer->lock);