forked from qt-creator/qt-creator
Wizards: fix crash when index is wrong
Task-number: QTCREATORBUG-20193 Change-Id: I20da636a3db478c6ff0d812b1b3dc3405f73cb8e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -904,12 +904,15 @@ void ListField::initializeData(MacroExpander *expander)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(widget(), return);
|
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;
|
QStandardItem *currentItem = m_index >= 0 ? m_itemList[uint(m_index)].get() : nullptr;
|
||||||
QList<QStandardItem*> expandedValuesItems;
|
QList<QStandardItem*> expandedValuesItems;
|
||||||
expandedValuesItems.reserve(int(m_itemList.size()));
|
expandedValuesItems.reserve(int(m_itemList.size()));
|
||||||
|
|
||||||
QSize maxIconSize;
|
|
||||||
|
|
||||||
for (const std::unique_ptr<QStandardItem> &item : m_itemList) {
|
for (const std::unique_ptr<QStandardItem> &item : m_itemList) {
|
||||||
bool condition = JsonWizard::boolFromVariant(item->data(ConditionRole), expander);
|
bool condition = JsonWizard::boolFromVariant(item->data(ConditionRole), expander);
|
||||||
if (!condition)
|
if (!condition)
|
||||||
|
Reference in New Issue
Block a user