From c227a4af41771771f87fd073ebaba2572d668ab3 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 8 Mar 2023 08:24:38 +0100 Subject: [PATCH] Check for invalid indexes in Module selection This should fix crashes when moving with pressed mouse buttons on category nods --- src/frontends/qt/GuiDocument.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index 8af560681c..3a8ae85796 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -324,6 +324,9 @@ void ModuleSelectionManager::updateAddPB() } QModelIndex const & idx = availableLV->selectionModel()->currentIndex(); + + if (!idx.isValid()) + return; if (getAvailableModel()->itemFromIndex(idx)->hasChildren()) { // This is a category header @@ -3337,6 +3340,9 @@ void GuiDocument::updateModuleInfo() } QModelIndex const & idx = lv->selectionModel()->currentIndex(); + if (!idx.isValid()) + return; + if (!focus_on_selected && modules_av_model_.itemFromIndex(idx)->hasChildren()) { // This is a category header -- 2.39.5