summaryrefslogtreecommitdiff
path: root/kde-misc/krusader/files/krusader-2.8.0-segfault.patch
blob: ac53d87722704c89b51a5fb690b3500bad4f63ae (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 2938db287f95a772792420f887dec2d88413409b Mon Sep 17 00:00:00 2001
From: Pavel Karelin <hkarel@yandex.ru>
Date: Fri, 25 Nov 2022 22:02:00 +0300
Subject: [PATCH] Fixed segmentation fault when using CTRL+Left/Right on a
 panel with invalid path

FIXED: [ 462086 ]  Segmentation fault when using CTRL+Left/Right on a panel with invalid path
BUG: 462086

Discussion: https://invent.kde.org/utilities/krusader/-/merge_requests/117
---
 app/Panel/listpanel.cpp | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/app/Panel/listpanel.cpp b/app/Panel/listpanel.cpp
index dde22a257..be785a49f 100644
--- a/app/Panel/listpanel.cpp
+++ b/app/Panel/listpanel.cpp
@@ -913,26 +913,26 @@ void ListPanel::keyPressEvent(QKeyEvent *e)
             // user pressed CTRL+Right/Left - refresh other panel to the selected path if it's a
             // directory otherwise as this one
             if ((isLeft() && e->key() == Qt::Key_Right) || (!isLeft() && e->key() == Qt::Key_Left)) {
-                QUrl newPath;
-                KrViewItem *it = view->getCurrentKrViewItem();
-
-                if (it->name() == "..") {
-                    newPath = KIO::upUrl(virtualPath());
-                } else {
-                    FileItem *v = func->getFileItem(it);
-                    // If it's a directory different from ".."
-                    if (v && v->isDir() && v->getName() != "..") {
-                        newPath = v->getUrl();
+                if (KrViewItem *it = view->getCurrentKrViewItem()) {
+                    QUrl newPath;
+                    if (it->name() == "..") {
+                        newPath = KIO::upUrl(virtualPath());
                     } else {
-                        // If it's a supported compressed file
-                        if (v && KrArcHandler::arcSupported(v->getMime()))   {
-                            newPath = func->browsableArchivePath(v->getUrl().fileName());
+                        FileItem *v = func->getFileItem(it);
+                        // If it's a directory different from ".."
+                        if (v && v->isDir() && v->getName() != "..") {
+                            newPath = v->getUrl();
                         } else {
-                            newPath = virtualPath();
+                            // If it's a supported compressed file
+                            if (v && KrArcHandler::arcSupported(v->getMime()))   {
+                                newPath = func->browsableArchivePath(v->getUrl().fileName());
+                            } else {
+                                newPath = virtualPath();
+                            }
                         }
                     }
+                    otherPanel()->func->openUrl(newPath);
                 }
-                otherPanel()->func->openUrl(newPath);
             } else {
                 func->openUrl(otherPanel()->virtualPath());
             }
-- 
GitLab