luaa: check that object is a table before calling lua_next()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
3af636c3e6
commit
3d2c205969
5
luaa.c
5
luaa.c
|
@ -295,8 +295,9 @@ luaA_next(lua_State *L, int idx)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return lua_next(L, idx);
|
||||
else if(lua_istable(L, idx))
|
||||
return lua_next(L, idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Generic pairs function.
|
||||
|
|
7
wibox.c
7
wibox.c
|
@ -716,14 +716,14 @@ wibox_widgets_table_build(lua_State *L, wibox_t *wibox)
|
|||
static bool
|
||||
luaA_wibox_hasitem(lua_State *L, wibox_t *wibox, const void *item)
|
||||
{
|
||||
bool ret = false;
|
||||
fprintf(stderr, "look for %p\n", item);
|
||||
if(wibox->widgets_table != LUA_REFNIL)
|
||||
{
|
||||
lua_rawgeti(globalconf.L, LUA_REGISTRYINDEX, wibox->widgets_table);
|
||||
if(lua_topointer(L, -1) == item || luaA_hasitem(L, item))
|
||||
ret = true;
|
||||
return true;
|
||||
}
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Invalidate a wibox by a Lua object (table, etc).
|
||||
|
@ -755,7 +755,6 @@ luaA_wibox_invalidate_byitem(lua_State *L, const void *item)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/** Wibox object.
|
||||
* \param L The Lua VM state.
|
||||
* \return The number of elements pushed on stack.
|
||||
|
|
Loading…
Reference in New Issue