[couchdb-glib] Only return a CouchDBStructField in couchdb_struct_field_get_struct_field if the field exists
- From: Rodrigo Moya <rodrigo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [couchdb-glib] Only return a CouchDBStructField in couchdb_struct_field_get_struct_field if the field exists
- Date: Thu, 12 Nov 2009 15:09:26 +0000 (UTC)
commit 5274911e58cafab77addce8d0c24d1fcce99bbe0
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Thu Nov 12 16:09:16 2009 +0100
Only return a CouchDBStructField in couchdb_struct_field_get_struct_field if the field exists
couchdb-glib/couchdb-struct-field.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/couchdb-glib/couchdb-struct-field.c b/couchdb-glib/couchdb-struct-field.c
index 37273f8..0335e73 100644
--- a/couchdb-glib/couchdb-struct-field.c
+++ b/couchdb-glib/couchdb-struct-field.c
@@ -224,6 +224,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]