[libgdata/calendar-v3: 1/4] core: Fix JSON parser state on hitting an error
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata/calendar-v3: 1/4] core: Fix JSON parser state on hitting an error
- Date: Mon, 13 Apr 2015 23:01:42 +0000 (UTC)
commit 5fef78ccd02184ae6b6635b36c92990c3fdaffc1
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Apr 13 23:54:16 2015 +0100
core: Fix JSON parser state on hitting an error
Close the entry element on error, otherwise the JsonParser stays in its
error state.
gdata/gdata-feed.c | 4 +++-
gdata/gdata-parsable.c | 1 +
2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index 68ed7a0..9609c8f 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 242f6b8..85ddaa6 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]