Commit 88ec941b authored by Murray Cumming's avatar Murray Cumming
Browse files

Field definition: Add some null checks.

Because this is preferrable to a crash, even though these nulls
should not happen.
parent 33cf0dc5
......@@ -519,6 +519,11 @@ std::shared_ptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::
void Box_DB_Table_Definition::on_field_definition_apply()
{
auto field_New = m_dialog_field_definition->get_field();
if(!field_New)
{
std::cerr << G_STRFUNC << ": field_New is null." << std::endl;
return;
}
if(*m_Field_BeingEdited != *field_New)
{
......
......@@ -213,6 +213,12 @@ void Dialog_FieldDefinition::set_field(const std::shared_ptr<const Field>& field
std::shared_ptr<Field> Dialog_FieldDefinition::get_field() const
{
if(!m_Field)
{
std::cerr << G_STRFUNC << ": m_Field is null." << std::endl;
return std::shared_ptr<Field>();
}
auto field = glom_sharedptr_clone(m_Field); //Start with the old details, to preserve anything that is not in our UI.
// const_cast is necessary and save here for the window (jhs)
auto sharedcnc = connect_to_server(const_cast<Dialog_FieldDefinition*>(this));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment