summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2015-04-13 23:54:16 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2015-04-14 00:00:25 +0100
commit220b4671bc4a8f503b4fdbebb06c01dd6c016b80 (patch)
tree598114d6e52ccce28b1516a73c12550d00341eb5
parent4496726447dd431004ccf872c45db6538df62fc2 (diff)
downloadlibgdata-220b4671bc4a8f503b4fdbebb06c01dd6c016b80.tar.gz
core: Fix JSON parser state on hitting an error
Close the entry element on error, otherwise the JsonParser stays in its error state.
-rw-r--r--gdata/gdata-feed.c4
-rw-r--r--gdata/gdata-parsable.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index 68ed7a06..9609c8f3 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -612,8 +612,10 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
/* Parse the node, passing it the reader cursor. */
entry = GDATA_ENTRY (_gdata_parsable_new_from_json_node (entry_type, reader, NULL, error));
- if (entry == NULL)
+ if (entry == NULL) {
+ json_reader_end_element (reader);
return FALSE;
+ }
/* Calls the callbacks in the main thread */
if (data != NULL)
diff --git a/gdata/gdata-parsable.c b/gdata/gdata-parsable.c
index 242f6b86..85ddaa64 100644
--- a/gdata/gdata-parsable.c
+++ b/gdata/gdata-parsable.c
@@ -526,6 +526,7 @@ _gdata_parsable_new_from_json_node (GType parsable_type, JsonReader *reader, gpo
g_return_val_if_fail (json_reader_read_element (reader, i), NULL);
if (klass->parse_json (parsable, reader, user_data, error) == FALSE) {
+ json_reader_end_element (reader);
g_object_unref (parsable);
return NULL;
}