From e61326fd0b5a5730efbb725b2a1c88c1fa089fe0 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Sat, 8 Jun 2013 13:39:16 -0400 Subject: [PATCH] Fix crash by not assuming standard shortcuts are present. Neither of the two standard shortcuts used here are *guaranteed* to be present (kdelibs filters both with some KAuthorized magic, and help_contents also depends on the documentation subsystem), so avoid crashing just because they're not around. First noticed on my Gentoo-provided Konsole which is compiled without the handbook USE flag. (cherry picked from commit 8950584966bb77b19f77f64116c1f624c89f5236) --- src/MainWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 0ba82f097..285d6347b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -176,15 +176,15 @@ void MainWindow::correctStandardShortcuts() { // replace F1 shortcut for help contents QAction* helpAction = actionCollection()->action("help_contents"); - Q_ASSERT(helpAction); - helpAction->setShortcut(QKeySequence()); + if (helpAction) { + helpAction->setShortcut(QKeySequence()); + } // replace Ctrl+B shortcut for bookmarks only if user hasn't already // changed the shortcut; however, if the user changed it to Ctrl+B // this will still get changed to Ctrl+Shift+B QAction* bookmarkAction = actionCollection()->action("add_bookmark"); - Q_ASSERT(bookmarkAction); - if (bookmarkAction->shortcut() == QKeySequence(Qt::CTRL + Qt::Key_B)) { + if (bookmarkAction && bookmarkAction->shortcut() == QKeySequence(Qt::CTRL + Qt::Key_B)) { bookmarkAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); } }