From fb62c00c3201e96106d6531d8e60d8a96e109a41 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 26 Nov 2013 23:09:04 +0000 Subject: [PATCH] Avoid endless recursion while pushing ucl arrays to lua. --- src/lua/lua_rcl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lua/lua_rcl.c b/src/lua/lua_rcl.c index cb5c46252..2768ac4a4 100644 --- a/src/lua/lua_rcl.c +++ b/src/lua/lua_rcl.c @@ -53,12 +53,12 @@ lua_rcl_obj_push_elt (lua_State *L, const char *key, ucl_object_t *obj) * @return */ static gint -lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj) +lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj, gboolean allow_array) { ucl_object_t *cur; ucl_object_iter_t it = NULL; - if (obj->next != NULL) { + if (allow_array && obj->next != NULL) { /* Actually we need to push this as an array */ return lua_rcl_obj_push_array (L, obj); } @@ -141,7 +141,7 @@ lua_rcl_obj_push (lua_State *L, ucl_object_t *obj, gboolean allow_array) { switch (obj->type) { case UCL_OBJECT: - return lua_rcl_obj_push_obj (L, obj); + return lua_rcl_obj_push_obj (L, obj, allow_array); case UCL_ARRAY: return lua_rcl_obj_push_array (L, obj->value.av); default: -- 2.39.5