summaryrefslogtreecommitdiff
path: root/gdata/gdata-entry.c
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2013-08-29 23:04:55 -0600
committerPhilip Withnall <philip@tecnocode.co.uk>2013-08-29 23:04:55 -0600
commitadfc260f9bb69adfce623882276b8578279baf63 (patch)
tree7ef7500de33f243d6a4e6dd192f22f57f235a216 /gdata/gdata-entry.c
parente18bec0f183b660cb7c4066dcc9e6577a819a895 (diff)
downloadlibgdata-tasks-integration.tar.gz
core: Finish JSON supporttasks-integration
This adds test cases which cover all of the new code, and fixes a number of small bugs. extra_json support is now complete.
Diffstat (limited to 'gdata/gdata-entry.c')
-rw-r--r--gdata/gdata-entry.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gdata/gdata-entry.c b/gdata/gdata-entry.c
index c1d3ce95..c3939808 100644
--- a/gdata/gdata-entry.c
+++ b/gdata/gdata-entry.c
@@ -602,13 +602,31 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
gdata_parser_string_from_json_member (reader, "etag", P_NON_EMPTY | P_NO_DUPES, &(priv->etag), &success, error) == TRUE) {
return success;
} else if (g_strcmp0 (json_reader_get_member_name (reader), "selfLink") == 0) {
- GDataLink *_link = gdata_link_new (json_reader_get_string_value (reader), GDATA_LINK_SELF);
+ GDataLink *_link;
+ const gchar *uri;
+
+ /* Empty URI? */
+ uri = json_reader_get_string_value (reader);
+ if (uri == NULL || *uri == '\0') {
+ return gdata_parser_error_required_json_content_missing (reader, error);
+ }
+
+ _link = gdata_link_new (uri, GDATA_LINK_SELF);
gdata_entry_add_link (GDATA_ENTRY (parsable), _link);
g_object_unref (_link);
return TRUE;
} else if (g_strcmp0 (json_reader_get_member_name (reader), "kind") == 0) {
- GDataCategory *category = gdata_category_new (json_reader_get_string_value (reader), "http://schemas.google.com/g/2005#kind", NULL);
+ GDataCategory *category;
+ const gchar *kind;
+
+ /* Empty kind? */
+ kind = json_reader_get_string_value (reader);
+ if (kind == NULL || *kind == '\0') {
+ return gdata_parser_error_required_json_content_missing (reader, error);
+ }
+
+ category = gdata_category_new (kind, "http://schemas.google.com/g/2005#kind", NULL);
gdata_entry_add_category (GDATA_ENTRY (parsable), category);
g_object_unref (category);