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:
Giuseppe D'Angelo 2016-10-24 21:05:28 +02:00
parent d36e472aea
commit 43daefb096

View File

@ -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);