lua: don't crash if an iterator is NULL
simply behave as if the iterator is valid and has no items in it
This commit is contained in:
@@ -391,7 +391,7 @@ iterator_next (lua_State *L)
|
|||||||
{
|
{
|
||||||
WpIterator *it = wplua_checkboxed (L, 1, WP_TYPE_ITERATOR);
|
WpIterator *it = wplua_checkboxed (L, 1, WP_TYPE_ITERATOR);
|
||||||
g_auto (GValue) v = G_VALUE_INIT;
|
g_auto (GValue) v = G_VALUE_INIT;
|
||||||
if (wp_iterator_next (it, &v)) {
|
if (it && wp_iterator_next (it, &v)) {
|
||||||
return wplua_gvalue_to_lua (L, &v);
|
return wplua_gvalue_to_lua (L, &v);
|
||||||
} else {
|
} else {
|
||||||
lua_pushnil (L);
|
lua_pushnil (L);
|
||||||
|
Reference in New Issue
Block a user