From: Juergen Spitzmueller Date: Wed, 8 Mar 2023 07:24:38 +0000 (+0100) Subject: Check for invalid indexes in Module selection X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c227a4af41771771f87fd073ebaba2572d668ab3;p=features.git Check for invalid indexes in Module selection This should fix crashes when moving with pressed mouse buttons on category nods --- 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