summaryrefslogtreecommitdiff
path: root/json-glib/json-path.c
diff options
context:
space:
mode:
Diffstat (limited to 'json-glib/json-path.c')
-rw-r--r--json-glib/json-path.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/json-glib/json-path.c b/json-glib/json-path.c
index 6199f51..e59a285 100644
--- a/json-glib/json-path.c
+++ b/json-glib/json-path.c
@@ -439,7 +439,7 @@ json_path_compile (JsonPath *path,
return FALSE;
}
- if (!(*(p + 1) == '.' || *(p + 1) == '['))
+ if (!(*(p + 1) == '.' || *(p + 1) == '[' || *(p + 1) == '\0'))
{
/* translators: the %c is the invalid character */
g_set_error (error, JSON_PATH_ERROR,
@@ -741,7 +741,10 @@ walk_path_node (GList *path,
switch (node->node_type)
{
case JSON_PATH_NODE_ROOT:
- walk_path_node (path->next, root, results);
+ if (path->next != NULL)
+ walk_path_node (path->next, root, results);
+ else
+ json_array_add_element (results, json_node_copy (root));
break;
case JSON_PATH_NODE_CHILD_MEMBER: