avoid two possible null pointer dereferences

move the setToolTip lines outside the if(action) inside it.
do not crash if there is no action.
This commit is contained in:
Jaime Torres 2011-10-09 11:12:22 +02:00
parent 0ebf2d1fe0
commit c9156fdaf9

View file

@ -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);
}
}