Qt: Fix out of bounds indices in InputModel
Vicki Pfau vi@endrift.com
Wed, 12 Jul 2017 19:22:34 -0700
1 files changed,
6 insertions(+),
0 deletions(-)
M
src/platform/qt/input/InputModel.cpp
→
src/platform/qt/input/InputModel.cpp
@@ -120,7 +120,13 @@
QModelIndex InputModel::index(int row, int column, const QModelIndex& parent) const { if (parent.isValid()) { InputModelItem* p = static_cast<InputModelItem*>(parent.internalPointer()); + if (row >= m_tree[p->obj].count()) { + return QModelIndex(); + } return createIndex(row, column, const_cast<InputModelItem*>(&m_tree[p->obj][row])); + } + if (row >= m_topLevelMenus.count()) { + return QModelIndex(); } return createIndex(row, column, const_cast<InputModelItem*>(&m_topLevelMenus[row])); }