From d31c9dbf6cf35f28fa1ed3b1db86a0896a6d04f9 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 7 Aug 2024 22:38:18 +0200 Subject: [PATCH] Bugfix: avoid a segfault in the property editor due to invalid array access (difficult to reproduce). --- src/layui/layui/layPropertiesDialog.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layui/layui/layPropertiesDialog.cc b/src/layui/layui/layPropertiesDialog.cc index 8a0fbe2749..773dcf1c59 100644 --- a/src/layui/layui/layPropertiesDialog.cc +++ b/src/layui/layui/layPropertiesDialog.cc @@ -379,7 +379,7 @@ PropertiesDialog::update_controls () mp_ui->apply_to_all_cbx->setChecked (m_object_indexes.size () > 1); - if (m_index < 0) { + if (m_index < 0 || m_index >= int (mp_properties_pages.size ())) { mp_stack->setCurrentWidget (mp_none); @@ -552,6 +552,10 @@ PropertiesDialog::apply () { BEGIN_PROTECTED + if (m_index < 0 || m_index >= int (mp_properties_pages.size ())) { + return; + } + db::Transaction t (mp_manager, tl::to_string (QObject::tr ("Apply changes")), m_transaction_id); try {