[glom] Added a guard clause when adding relationships from fields



commit 5423236f51a545e592ac34ba22aaaa816c8faf7d
Author: Michael Hasselmann <michaelh openismus com>
Date:   Wed Feb 3 13:26:06 2010 +0100

    Added a guard clause when adding relationships from fields
    
    * glom/libglom/utils.cc (add_to_relationships_list): If an invalid layout item
    is passed then its relationship cannot be queried. Libglom users can also force
    layout item fields that are null into this function, hence an additional guard
    clause was added.

 ChangeLog             |    9 +++++++++
 glom/libglom/utils.cc |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a8d0185..d5935b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-03  Michael Hasselmann  <michaelh openismus com>
+
+	Added a guard clause when adding relationships from fields
+
+	* glom/libglom/utils.cc (add_to_relationships_list): If an invalid layout item
+	is passed then its relationship cannot be queried. Libglom users can also force
+	layout item fields that are null into this function, hence an additional guard
+	clause was added.
+
 2010-02-02  Murray Cumming  <murrayc murrayc com>
 
   Do not include pygtk.h
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 0d319fe..6e99c58 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -212,6 +212,8 @@ typedef std::list< sharedptr<const UsesRelationship> > type_list_relationships;
 
 static void add_to_relationships_list(type_list_relationships& list_relationships, const sharedptr<const LayoutItem_Field>& layout_item)
 {
+  g_return_if_fail(layout_item);
+
   if(!(layout_item->get_has_relationship_name()))
     return;
 



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