Check for invalid indexes in Module selection

This should fix crashes when moving with pressed mouse buttons on
category nods
This commit is contained in:
Juergen Spitzmueller 2023-03-08 08:24:38 +01:00
parent 56a3a90955
commit c227a4af41

View 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