Bugfix: avoid a segfault in the properties dialog

This commit is contained in:
Matthias Koefferlein 2023-08-27 11:28:20 +02:00
parent 695ec041af
commit 38f08d3e90
1 changed files with 2 additions and 1 deletions

View File

@ -272,6 +272,7 @@ PropertiesDialog::disconnect ()
delete *p; delete *p;
} }
mp_properties_pages.clear (); mp_properties_pages.clear ();
m_index = -1;
} }
void void
@ -604,7 +605,7 @@ PropertiesDialog::ok_pressed ()
{ {
BEGIN_PROTECTED BEGIN_PROTECTED
if (! mp_properties_pages [m_index]->readonly ()) { if (m_index >= 0 && m_index < int (mp_properties_pages.size ()) && ! mp_properties_pages [m_index]->readonly ()) {
db::Transaction t (mp_manager, tl::to_string (QObject::tr ("Apply changes")), m_transaction_id); db::Transaction t (mp_manager, tl::to_string (QObject::tr ("Apply changes")), m_transaction_id);