]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fixes Dolphin crash on "Defocus Terminal Panel" menu click if no Konsole is installed.
authorNikolai Krasheninnikov <nkrasheninnikov@yandex.ru>
Fri, 1 May 2020 17:44:58 +0000 (20:44 +0300)
committerNikolai Krasheninnikov <nkrasheninnikov@yandex.ru>
Mon, 4 May 2020 19:40:06 +0000 (22:40 +0300)
Summary:
Dolphin crashes if no Konsole is installed and user clicks menu action "Defocus Terminal Panel".
This fix is pretty straight forward.

Steps to reproduce:
1. Run Dolphin without Konsole available.
2. Press F4 to open console window.
3. Click in service menu "Focus Terminal Panel".
4. Click in service menu "Defocus Terminal Panel". Observe the crash.

Test Plan:
1. Run Dolphin without Konsole available.
2. Press F4 to open console window.
3. Click in service menu "Focus Teminal Panel".
4. Click in service menu "Defocus Terminal Panel".
5. Click in service menu "Focus Terminal Panel".
6. Press F4 to close console window.

Reviewers: #dolphin, meven, elvisangelaccio, ngraham

Reviewed By: #dolphin, meven, elvisangelaccio, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29345

src/panels/terminal/terminalpanel.cpp

index 861afebee0330fa2fd5c9ffc4917630a29809f6b..59b2694fb01aaf03cb0fe01702df5489afc8122c 100644 (file)
@@ -267,5 +267,9 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString& dir)
 
 bool TerminalPanel::terminalHasFocus() const
 {
-    return m_terminalWidget->hasFocus();
+    if (m_terminalWidget) {
+        return m_terminalWidget->hasFocus();
+    }
+
+    return hasFocus();
 }