Fix a goto jumping past va_end

Found by coverity
This commit is contained in:
Alexander van Gessel 2013-12-12 20:33:13 +01:00
parent e76a18d0f2
commit 8748b68b87

View File

@ -372,13 +372,14 @@ bool luaW_getglobal(lua_State *L, ...)
lua_rawget(L, -2);
lua_remove(L, -2);
}
va_end(ap);
if (lua_isnil(L, -1)) {
discard:
va_end(ap);
lua_pop(L, 1);
return false;
}
va_end(ap);
return true;
}
@ -415,4 +416,4 @@ unit *luaW_checkunit(lua_State *L, int index, bool only_on_map)
unit *u = luaW_tounit(L, index, only_on_map);
if (!u) luaL_typerror(L, index, "unit");
return u;
}
}