QStringListModel: fix corner-case in sibling()
A negative row can be passed but should not result in a spurious index returned. Change-Id: I57f180615020d24826e9b3807557ba172ed469c3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
d36e472aea
commit
43daefb096
@ -131,7 +131,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const
|
||||
*/
|
||||
QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex &idx) const
|
||||
{
|
||||
if (!idx.isValid() || column != 0 || row >= lst.count())
|
||||
if (!idx.isValid() || column != 0 || row >= lst.count() || row < 0)
|
||||
return QModelIndex();
|
||||
|
||||
return createIndex(row, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user