Core: Turn soft assert into if clause

It is perfectly legal to have a plugin disabled that was
enabled before. If the respective plugin has an output
pane the respective setting had been stored and the pane
can not be restored when the plugin is not loaded.

Change-Id: I25910c44dba83faf3c52ae836f2e83d0e69236d5
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2018-04-24 14:07:17 +02:00
parent fd42415c05
commit ef9c5e47bb

View File

@@ -432,7 +432,8 @@ void OutputPaneManager::readSettings()
settings->setArrayIndex(i); settings->setArrayIndex(i);
Id id = Id::fromSetting(settings->value(QLatin1String(outputPaneIdKeyC))); Id id = Id::fromSetting(settings->value(QLatin1String(outputPaneIdKeyC)));
const int idx = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::id, id)); const int idx = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::id, id));
QTC_ASSERT(idx >= 0, continue); if (idx < 0) // happens for e.g. disabled plugins (with outputpanes) that were loaded before
continue;
const bool visible = settings->value(QLatin1String(outputPaneVisibleKeyC)).toBool(); const bool visible = settings->value(QLatin1String(outputPaneVisibleKeyC)).toBool();
g_outputPanes[idx].buttonVisible = visible; g_outputPanes[idx].buttonVisible = visible;
g_outputPanes[idx].button->setVisible(visible); g_outputPanes[idx].button->setVisible(visible);