Skip to content
Snippets Groups Projects
Commit ef8ad3c6 authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by gerrit2
Browse files

recentmodel: check for invalid top node index

Return invalid QModelIndex in the case that is a top node
but out of range.

Issue: #75334
Change-Id: I3f6784b757d504fc8103208fe1ba341c1cfaf5da
parent 21c1a56e
No related branches found
No related tags found
No related merge requests found
...@@ -327,6 +327,9 @@ QModelIndex RecentModel::index( int row, int column, const QModelIndex& parent) ...@@ -327,6 +327,9 @@ QModelIndex RecentModel::index( int row, int column, const QModelIndex& parent)
if (!parent.isValid() && row >= 0 && row < d_ptr->m_lTopLevelReverted.size() && !column) if (!parent.isValid() && row >= 0 && row < d_ptr->m_lTopLevelReverted.size() && !column)
return createIndex(row, 0, d_ptr->m_lTopLevelReverted[d_ptr->m_lTopLevelReverted.size() - 1 - row]); return createIndex(row, 0, d_ptr->m_lTopLevelReverted[d_ptr->m_lTopLevelReverted.size() - 1 - row]);
if (!parent.isValid())
return QModelIndex();
RecentViewNode* node = static_cast<RecentViewNode*>(parent.internalPointer()); RecentViewNode* node = static_cast<RecentViewNode*>(parent.internalPointer());
if (row >= 0 && row < node->m_lChildren.size()) if (row >= 0 && row < node->m_lChildren.size())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment