summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-jsonc/src/jsonc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/luci-lib-jsonc/src/jsonc.c')
-rw-r--r--libs/luci-lib-jsonc/src/jsonc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/luci-lib-jsonc/src/jsonc.c b/libs/luci-lib-jsonc/src/jsonc.c
index 49cb21f5b..827fde884 100644
--- a/libs/luci-lib-jsonc/src/jsonc.c
+++ b/libs/luci-lib-jsonc/src/jsonc.c
@@ -286,8 +286,9 @@ static struct json_object * _lua_to_json(lua_State *L, int index)
lua_pushvalue(L, -2);
key = lua_tostring(L, -1);
- json_object_object_add(obj, key,
- _lua_to_json(L, lua_gettop(L) - 1));
+ if (key)
+ json_object_object_add(obj, key,
+ _lua_to_json(L, lua_gettop(L) - 1));
lua_pop(L, 2);
}