[couchdb-glib/gnome-2-28] Only return a CouchDBStructField in couchdb_struct_field_get_struct_field if the field exists



commit ff32c7171ecdd04e601bd4e547dd15bbd16329fe
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Thu Nov 12 16:07:36 2009 +0100

    Only return a CouchDBStructField in couchdb_struct_field_get_struct_field if the field exists

 couchdb-glib/couchdb-types.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/couchdb-glib/couchdb-types.c b/couchdb-glib/couchdb-types.c
index f332cf6..5f30896 100644
--- a/couchdb-glib/couchdb-types.c
+++ b/couchdb-glib/couchdb-types.c
@@ -408,6 +408,9 @@ couchdb_struct_field_get_struct_field (CouchDBStructField *sf, const char *field
 	g_return_val_if_fail (sf != NULL, NULL);
 	g_return_val_if_fail (field != NULL, NULL);
 
+	if (!json_object_has_member (sf->json_object, field))
+		return NULL;
+
 	return couchdb_struct_field_new_from_json_object (
 		json_object_get_object_member (sf->json_object, field));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]