m-lua-scripting/api: fix om:lookup() to return nil when no object was found

This commit is contained in:
George Kiagiadakis
2021-02-05 12:03:41 +02:00
parent d94b0a2f0c
commit 148a33187e

View File

@@ -568,8 +568,11 @@ object_manager_lookup (lua_State *L)
} else {
o = wp_object_manager_lookup (om, WP_TYPE_OBJECT, NULL);
}
wplua_pushobject (L, o);
return 1;
if (o) {
wplua_pushobject (L, o);
return 1;
}
return 0;
}
static const luaL_Reg object_manager_methods[] = {