]> git.lyx.org Git - lyx.git/commitdiff
Check for invalid indexes in Module selection
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 8 Mar 2023 07:24:38 +0000 (08:24 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 8 Mar 2023 07:24:38 +0000 (08:24 +0100)
This should fix crashes when moving with pressed mouse buttons on
category nods

src/frontends/qt/GuiDocument.cpp

index 8af560681c36dcae2545b7817491a083cf3e1408..3a8ae85796cb1c800c28bbac83f4b1f6f87561ac 100644 (file)
@@ -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