]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix argument checks for coroutine.create().
authorMike Pall <mike>
Mon, 28 May 2012 19:38:23 +0000 (21:38 +0200)
committerMike Pall <mike>
Mon, 28 May 2012 19:38:23 +0000 (21:38 +0200)
src/lib_base.c

index 927c1bca96457c68b955c6dba6131b805b9f3f92..149aa5cf976d6b8eed0a301ee3f93fd0ff592ef2 100644 (file)
@@ -550,9 +550,10 @@ LJLIB_CF(coroutine_running)
 
 LJLIB_CF(coroutine_create)
 {
-  lua_State *L1 = lua_newthread(L);
+  lua_State *L1;
   if (!(L->base < L->top && tvisfunc(L->base)))
     lj_err_argt(L, 1, LUA_TFUNCTION);
+  L1 = lua_newthread(L);
   setfuncV(L, L1->top++, funcV(L->base));
   return 1;
 }