diff --git a/src/platform/qt/input/InputModel.cpp b/src/platform/qt/input/InputModel.cpp index ccfecdeb2..7b4483f70 100644 --- a/src/platform/qt/input/InputModel.cpp +++ b/src/platform/qt/input/InputModel.cpp @@ -120,8 +120,14 @@ QVariant InputModel::headerData(int section, Qt::Orientation orientation, int ro QModelIndex InputModel::index(int row, int column, const QModelIndex& parent) const { if (parent.isValid()) { InputModelItem* p = static_cast(parent.internalPointer()); + if (row >= m_tree[p->obj].count()) { + return QModelIndex(); + } return createIndex(row, column, const_cast(&m_tree[p->obj][row])); } + if (row >= m_topLevelMenus.count()) { + return QModelIndex(); + } return createIndex(row, column, const_cast(&m_topLevelMenus[row])); }