glom r1396 - in trunk: . glom/mode_data glom/utility_widgets/db_adddel



Author: jhs
Date: Fri Jan 25 10:13:45 2008
New Revision: 1396
URL: http://svn.gnome.org/viewvc/glom?rev=1396&view=rev

Log:
2008-01-25  Johannes Schmid <johannes schmid openismus com>

	* glom/mode_data/box_data_details.cc:
	* glom/utility_widgets/db_adddel/db_adddel.cc:
	
	Fixed two crasher related to working with empty layout/empty tables

Modified:
   trunk/ChangeLog
   trunk/glom/mode_data/box_data_details.cc
   trunk/glom/utility_widgets/db_adddel/db_adddel.cc

Modified: trunk/glom/mode_data/box_data_details.cc
==============================================================================
--- trunk/glom/mode_data/box_data_details.cc	(original)
+++ trunk/glom/mode_data/box_data_details.cc	Fri Jan 25 10:13:45 2008
@@ -156,9 +156,12 @@
 
 void Box_Data_Details::set_found_set_from_primary_key_value()
 {
-  m_found_set.m_where_clause = "\"" + m_table_name + "\".\"" + m_field_primary_key->get_name() + 
-    "\" = " + m_field_primary_key->sql(m_primary_key_value);
-  //std::cout << "  DEBUG: Box_Data_Details::set_primary_key_value(): m_found_set.m_where_clause = " << m_found_set.m_where_clause << std::endl;
+  if (!m_primary_key_value.is_null())
+  {
+    m_found_set.m_where_clause = "\"" + m_table_name + "\".\"" + m_field_primary_key->get_name() + 
+      "\" = " + m_field_primary_key->sql(m_primary_key_value);
+    //std::cout << "  DEBUG: Box_Data_Details::set_primary_key_value(): m_found_set.m_where_clause = " << m_found_set.m_where_clause << std::endl;
+  }
 }
 
 bool Box_Data_Details::init_db_details(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value)
@@ -169,7 +172,7 @@
   m_field_primary_key = get_field_primary_key_for_table(found_set.m_table_name);
    
   const bool result = Box_Data::init_db_details(found_set); //Calls create_layout(), then fill_from_database()
-  
+
   //This is not used much, but we create it anyway:
   m_found_set = found_set; //Not used much.
   set_found_set_from_primary_key_value();

Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.cc	(original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.cc	Fri Jan 25 10:13:45 2008
@@ -1638,7 +1638,7 @@
     bool row_exists = static_cast<const Gtk::TreeView&>(m_TreeView).get_path_at_pos((int)event->x, (int)event->y, path, pColumn, cell_x, cell_y);
 
     //Get the row:
-    if(row_exists)
+    if(row_exists && m_refListStore)
     {
       Gtk::TreeModel::iterator iterRow = m_refListStore->get_iter(path);
       if(iterRow)



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