aboutsummaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
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);