diff --git a/src/simpletreemodel.h b/src/simpletreemodel.h index 3d4180229..4655cd859 100644 --- a/src/simpletreemodel.h +++ b/src/simpletreemodel.h @@ -64,7 +64,7 @@ int SimpleTreeModel::columnCount(const QModelIndex &) const { template QModelIndex SimpleTreeModel::index(int row, int, const QModelIndex& parent) const { T* parent_item = IndexToItem(parent); - if (!parent_item || parent_item->children.count() <= row) + if (!parent_item || row < 0 || parent_item->children.count() <= row) return QModelIndex(); return ItemToIndex(parent_item->children[row]);