diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2018-04-04 12:26:45 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2018-04-09 08:28:10 +0000 |
commit | 18ad5653d5cce51a02109e4955c1f4655d76b886 (patch) | |
tree | 1a9bbeabf5b71eb8cbec2d9b59d2fe208396d8c3 /src/plugins/projectexplorer/jsonwizard | |
parent | e6898fd863bfd671a0eacb2a46c33bbd35ee7fb8 (diff) |
Wizards: fix crash when index is wrong
Task-number: QTCREATORBUG-20193
Change-Id: I20da636a3db478c6ff0d812b1b3dc3405f73cb8e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/jsonwizard')
-rw-r--r-- | src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index 96a9d1a554..ccf3cd1b04 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -904,12 +904,15 @@ void ListField::initializeData(MacroExpander *expander) { QTC_ASSERT(widget(), return); + if (m_index >= m_itemList.size()) { + qWarning().noquote() << QString("%1 (\"%2\") has an index of %3 which does not exist.").arg(type(), name(), QString::number(m_index)); + m_index = -1; + } + QStandardItem *currentItem = m_index >= 0 ? m_itemList[uint(m_index)].get() : nullptr; QList<QStandardItem*> expandedValuesItems; expandedValuesItems.reserve(int(m_itemList.size())); - QSize maxIconSize; - for (const std::unique_ptr<QStandardItem> &item : m_itemList) { bool condition = JsonWizard::boolFromVariant(item->data(ConditionRole), expander); if (!condition) |