Fix range checking in AbstractItemModel examples
Task-number: QTBUG-23574
Change-Id: I6f2d4c18e1fb33ee369ebc75f501e524e8e63615
Reviewed-by: Martin Jones <martin.jones@nokia.com>
}
QVariant AnimalModel::data(const QModelIndex & index, int role) const {
- if (index.row() < 0 || index.row() > m_animals.count())
+ if (index.row() < 0 || index.row() >= m_animals.count())
return QVariant();
const Animal &animal = m_animals[index.row()];
}
QVariant AnimalModel::data(const QModelIndex & index, int role) const {
- if (index.row() < 0 || index.row() > m_animals.count())
+ if (index.row() < 0 || index.row() >= m_animals.count())
return QVariant();
const Animal &animal = m_animals[index.row()];