[glom] Fixed a crash that got uncovered by the previous commit



commit 979547ad50c9310116bbaa1c1c97d4b0b4c39849
Author: Michael Hasselmann <michaelh openismus com>
Date:   Wed Feb 3 14:08:26 2010 +0100

    Fixed a crash that got uncovered by the previous commit
    
    * glom/libglom/utils.cc (build_sql_select_fields_to_get): Warn about layout
    items that are null and skip them.

 ChangeLog             |    6 ++++++
 glom/libglom/utils.cc |    5 +++++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d5935b6..65f1c1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-02-03  Michael Hasselmann  <michaelh openismus com>
 
+	Fixed a crash that got uncovered by the previous commit
+
+	* glom/libglom/utils.cc (build_sql_select_fields_to_get): Warn about layout
+	items that are null and skip them.
+
+
 	Added a guard clause when adding relationships from fields
 
 	* glom/libglom/utils.cc (add_to_relationships_list): If an invalid layout item
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 6e99c58..4f4fdd2 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -270,6 +270,11 @@ Glib::ustring Utils::build_sql_select_fields_to_get(const Glib::ustring& table_n
     Glib::ustring one_sql_part;
 
     sharedptr<const LayoutItem_Field> layout_item = *iter;
+    if(!layout_item)
+    {
+      g_warn_if_reached();
+      continue;
+    }
 
     bool is_summary = false;
     const LayoutItem_FieldSummary* fieldsummary = dynamic_cast<const LayoutItem_FieldSummary*>(layout_item.obj());



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