summaryrefslogtreecommitdiff
path: root/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-crash-w-stale-indexes.patch
blob: b77a72a3e502f4315af12020441777034f1dc046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From ad82b876016367bd9765185dba84600985e5d0fd Mon Sep 17 00:00:00 2001
From: Waqar Ahmed <waqar.17a@gmail.com>
Date: Fri, 18 Mar 2022 10:14:28 +0500
Subject: [PATCH] Fix crash with stale indexes

BUG: 451593
---
 src/completion/katecompletionmodel.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/completion/katecompletionmodel.cpp b/src/completion/katecompletionmodel.cpp
index 1e241f0d..d9bb8421 100644
--- a/src/completion/katecompletionmodel.cpp
+++ b/src/completion/katecompletionmodel.cpp
@@ -914,6 +914,11 @@ QModelIndex KateCompletionModel::mapToSource(const QModelIndex &proxyIndex) cons
     }
 
     if (Group *g = groupOfParent(proxyIndex)) {
+        if (!m_rowTable.contains(g)) {
+            qWarning() << Q_FUNC_INFO << "Stale proxy index for which there is no group";
+            return {};
+        }
+
         if (proxyIndex.row() >= 0 && proxyIndex.row() < (int)g->filtered.size()) {
             ModelRow source = g->filtered[proxyIndex.row()].sourceRow();
             return source.second.sibling(source.second.row(), proxyIndex.column());
-- 
GitLab