[gom] gom: Don't assert when the primary key isn't set



commit dc6164dc7d3c626ce149f03b0b2e41ef515166f9
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Sep 26 20:56:08 2014 +0200

    gom: Don't assert when the primary key isn't set
    
    gjs will want to set the primary key after the object has been
    constructed. We'll assert() at the first use of the resource instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728301

 gom/gom-resource.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gom/gom-resource.c b/gom/gom-resource.c
index 1a46084..c076b52 100644
--- a/gom/gom-resource.c
+++ b/gom/gom-resource.c
@@ -532,7 +532,8 @@ has_primary_key (GomResource *resource)
 
    pspec = g_object_class_find_property(G_OBJECT_CLASS(klass),
                                         klass->primary_key);
-   g_assert(pspec);
+   if (!pspec)
+      return FALSE;
 
    g_value_init(&value, pspec->value_type);
    g_object_get_property(G_OBJECT(resource), klass->primary_key, &value);


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