[LyX/master] Check for invalid indexes in Module selection
Juergen Spitzmueller
spitz at lyx.org
Wed Mar 8 06:23:07 UTC 2023
commit c227a4af41771771f87fd073ebaba2572d668ab3
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Wed Mar 8 08:24:38 2023 +0100
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 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 8af5606..3a8ae85 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
More information about the lyx-cvs
mailing list