Analyzer: Fix soft assert on startup

Fix "SOFT ASSERT: str && *str" when using the analyzer for the
first time / with nuked settings.

Change-Id: Id6f0fc8031fc8d8a24d6d4c0badfbfbdc98974a9
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Kai Koehne
2012-12-14 12:34:15 +01:00
committed by hjk
parent 0a556c2fe1
commit ba71b3e9be

View File

@@ -580,6 +580,8 @@ QAction *AnalyzerManagerPrivate::actionFromToolAndMode(IAnalyzerTool *tool, Star
void AnalyzerManagerPrivate::selectSavedTool() void AnalyzerManagerPrivate::selectSavedTool()
{ {
const QSettings *settings = ICore::settings(); const QSettings *settings = ICore::settings();
if (settings->contains(QLatin1String(LAST_ACTIVE_TOOL))) {
const Id lastActiveAction(settings->value(QLatin1String(LAST_ACTIVE_TOOL)).toString()); const Id lastActiveAction(settings->value(QLatin1String(LAST_ACTIVE_TOOL)).toString());
foreach (QAction *action, m_actions) { foreach (QAction *action, m_actions) {
IAnalyzerTool *tool = m_toolFromAction.value(action); IAnalyzerTool *tool = m_toolFromAction.value(action);
@@ -589,6 +591,7 @@ void AnalyzerManagerPrivate::selectSavedTool()
return; return;
} }
} }
}
// fallback to first available tool // fallback to first available tool
if (!m_actions.isEmpty()) { if (!m_actions.isEmpty()) {
IAnalyzerTool *tool = m_toolFromAction.value(m_actions.first()); IAnalyzerTool *tool = m_toolFromAction.value(m_actions.first());