From: Jaime Torres Date: Sun, 9 Oct 2011 09:12:22 +0000 (+0200) Subject: avoid two possible null pointer dereferences X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/c9156fdaf9dd3f5bad649659a2533a561deb90e0 avoid two possible null pointer dereferences move the setToolTip lines outside the if(action) inside it. do not crash if there is no action. --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 1150b7488..1b2b971c2 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -441,14 +441,14 @@ void DolphinMainWindow::updateHistory() const int index = urlNavigator->historyIndex(); QAction* backAction = actionCollection()->action("go_back"); - backAction->setToolTip(i18nc("@info", "Go back")); if (backAction) { + backAction->setToolTip(i18nc("@info", "Go back")); backAction->setEnabled(index < urlNavigator->historySize() - 1); } QAction* forwardAction = actionCollection()->action("go_forward"); - forwardAction->setToolTip(i18nc("@info", "Go forward")); if (forwardAction) { + forwardAction->setToolTip(i18nc("@info", "Go forward")); forwardAction->setEnabled(index > 0); } }