[couchdb-glib] Check existence of members before calling json_object_get_* to avoid warnings
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [couchdb-glib] Check existence of members before calling json_object_get_* to avoid warnings
- Date: Mon, 7 Feb 2011 16:06:37 +0000 (UTC)
commit 03f1532de9b8d709eb9c54389a600a8d4fd1bee5
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Mon Feb 7 17:06:20 2011 +0100
Check existence of members before calling json_object_get_* to avoid warnings
couchdb-glib/couchdb-design-document.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/couchdb-glib/couchdb-design-document.c b/couchdb-glib/couchdb-design-document.c
index d332d81..25ec0e3 100644
--- a/couchdb-glib/couchdb-design-document.c
+++ b/couchdb-glib/couchdb-design-document.c
@@ -125,8 +125,9 @@ couchdb_design_document_add_view (CouchdbDesignDocument *document,
if (json_object != NULL) {
JsonObject *json_views, *this_view;
- json_views = json_object_get_object_member (json_object, "views");
- if (json_views == NULL) {
+ if (json_object_has_member (json_object, "views"))
+ json_views = json_object_get_object_member (json_object, "views");
+ else {
json_views = json_object_new ();
json_object_set_object_member (json_object, "views", json_views);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]