Fix read from before beginning of stack

This commit is contained in:
Thomas Goyne 2014-04-27 20:46:43 -07:00
parent b4de0b9b82
commit ec4a8c9a26
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ inline void push_value(lua_State *L, std::string const& value) {
}
inline void push_value(lua_State *L, lua_CFunction value) {
if (lua_type(L, -2) == LUA_TUSERDATA) {
if (lua_gettop(L) >= 2 && lua_type(L, -2) == LUA_TUSERDATA) {
lua_pushvalue(L, -2);
lua_pushcclosure(L, value, 1);
}