diff --git a/src/libkore.c b/src/libkore.c index 5331020..6430d4e 100644 --- a/src/libkore.c +++ b/src/libkore.c @@ -89,6 +89,11 @@ int coroutine_iter_next(struct co_obj *obj){ lua_rawgeti(L,LUA_REGISTRYINDEX,obj->ref); lua_call(L,1,1); const char *status = luaL_checklstring(L,-1,NULL); + if(strcmp(status,"dead") == 0){ + kore_log(LOG_ERR,"Coroutine was dead when it was passed to coroutine iter next"); + lua_pushstring(L,"Coroutine was dead when passed to coroutine iter next"); + lua_error(L); + } lua_pop(L,lua_gettop(L)); lua_getglobal(L,"coroutine"); lua_getfield(L,-1,"resume");