summaryrefslogtreecommitdiff
path: root/libs/liblua/src/lcorolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/liblua/src/lcorolib.c')
-rw-r--r--libs/liblua/src/lcorolib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/liblua/src/lcorolib.c b/libs/liblua/src/lcorolib.c
index 7d6e585b1d..c165031d28 100644
--- a/libs/liblua/src/lcorolib.c
+++ b/libs/liblua/src/lcorolib.c
@@ -73,11 +73,12 @@ static int luaB_coresume (lua_State *L) {
static int luaB_auxwrap (lua_State *L) {
lua_State *co = lua_tothread(L, lua_upvalueindex(1));
int r = auxresume(L, co, lua_gettop(L));
- if (r < 0) {
+ if (r < 0) { /* error? */
int stat = lua_status(co);
- if (stat != LUA_OK && stat != LUA_YIELD)
- lua_resetthread(co); /* close variables in case of errors */
- if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */
+ if (stat != LUA_OK && stat != LUA_YIELD) /* error in the coroutine? */
+ lua_resetthread(co); /* close its tbc variables */
+ if (stat != LUA_ERRMEM && /* not a memory error and ... */
+ lua_type(L, -1) == LUA_TSTRING) { /* ... error object is a string? */
luaL_where(L, 1); /* add extra info, if available */
lua_insert(L, -2);
lua_concat(L, 2);