Add row count check in the RsFriendListModel::index method

Fix bug occurring after login where the app would crash unexpectedly.
Turns out there was an index out of bounds exception occurring in
the RsFriendListModel::index method.
This commit is contained in:
Vlad Pirlog 2023-12-27 12:41:25 +02:00
parent 081782c97c
commit b5d40f7964
No known key found for this signature in database
GPG Key ID: 3BC079E13034C758

View File

@ -287,7 +287,7 @@ uint32_t RsFriendListModel::EntryIndex::parentRow(uint32_t nb_groups) const
QModelIndex RsFriendListModel::index(int row, int column, const QModelIndex& parent) const QModelIndex RsFriendListModel::index(int row, int column, const QModelIndex& parent) const
{ {
if(row < 0 || column < 0 || column >= COLUMN_THREAD_NB_COLUMNS) if(row < 0 || column < 0 || column >= columnCount(parent) || row >= rowCount(parent))
return QModelIndex(); return QModelIndex();
if(parent.internalId() == 0) if(parent.internalId() == 0)