[gnome-online-accounts] google: Avoid CRITICALs if get_identity_sync can't parse response
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] google: Avoid CRITICALs if get_identity_sync can't parse response
- Date: Wed, 2 Aug 2017 19:31:48 +0000 (UTC)
commit 1d933a3830be4c3800e693af5b53f7c2da55c35b
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Aug 2 17:45:54 2017 +0200
google: Avoid CRITICALs if get_identity_sync can't parse response
The json_object_get_string_member API expects the member to be present.
Therefore, we should not use its return value to determine its
availability. Otherwise it will lead to:
Json-CRITICAL **: json_object_get_string_member: assertion
'node != NULL' failed
https://bugzilla.gnome.org/show_bug.cgi?id=785726
src/goabackend/goagoogleprovider.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
index 42a177a..5510553 100644
--- a/src/goabackend/goagoogleprovider.c
+++ b/src/goabackend/goagoogleprovider.c
@@ -211,8 +211,7 @@ get_identity_sync (GoaOAuth2Provider *oauth2_provider,
}
json_object = json_node_get_object (json_parser_get_root (parser));
- email = g_strdup (json_object_get_string_member (json_object, "email"));
- if (email == NULL)
+ if (!json_object_has_member (json_object, "email"))
{
g_warning ("Did not find email in JSON data");
g_set_error (error,
@@ -222,6 +221,7 @@ get_identity_sync (GoaOAuth2Provider *oauth2_provider,
goto out;
}
+ email = g_strdup (json_object_get_string_member (json_object, "email"));
ret = email;
email = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]