[glom] null pointer check
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] null pointer check
- Date: Wed, 3 Apr 2013 00:35:05 +0000 (UTC)
commit 5202e64b936738fb7a5096aa182287f5e38cb803
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Apr 3 02:34:58 2013 +0200
null pointer check
glom/dialog_existing_or_new.cc | 7 ++++++-
glom/libglom/db_utils.cc | 10 ++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index ddaf383..7f0c3e2 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -766,13 +766,18 @@ void Dialog_ExistingOrNew::on_service_removed(const Glib::ustring& name, const G
if((*iter)[m_existing_columns.m_col_service_name] == name)
{
const bool was_expanded = m_existing_view->row_expanded(m_existing_model->get_path(iter));
+
// Remove from store
epc_service_info_unref((*iter)[m_existing_columns.m_col_service_info]);
m_existing_model->erase(iter);
+
// Reinsert dummy, if necessary
if(children.begin() == children.end())
m_iter_existing_network_dummy = create_dummy_item_existing(m_iter_existing_network,
_(NETWORK_DUMMY_TEXT));
- if(was_expanded) m_existing_view->expand_row(m_existing_model->get_path(iter), false);
+
+ if(was_expanded)
+ m_existing_view->expand_row(m_existing_model->get_path(iter), false);
+
break;
}
}
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index c566c0b..f7b0508 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1199,16 +1199,18 @@ bool create_table_with_default_fields(Document* document, const Glib::ustring& t
table_info->set_name(table_name);
table_info->set_title_original( Utils::title_from_string( table_name ) ); //Start with a title that might
be appropriate.
+ if(!document)
+ {
+ std::cerr << G_STRFUNC << ": document was null." << std::endl;
+ return false;
+ }
+
created = create_table(document->get_hosting_mode(), table_info, fields);
-
if(created)
{
//Save the changes in the document:
- if(document)
- {
document->add_table(table_info);
document->set_table_fields(table_info->get_name(), fields);
- }
}
return created;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]