diff --git a/src/core/qgsbrowsermodel.cpp b/src/core/qgsbrowsermodel.cpp index 02a806e8e2d..4abc12785ea 100644 --- a/src/core/qgsbrowsermodel.cpp +++ b/src/core/qgsbrowsermodel.cpp @@ -337,6 +337,10 @@ void QgsBrowserModel::reload() QModelIndex QgsBrowserModel::index( int row, int column, const QModelIndex &parent ) const { + if ( column < 0 || column >= columnCount( parent ) || + row < 0 || row >= rowCount( parent ) ) + return QModelIndex(); + QgsDataItem *p = dataItem( parent ); const QVector &items = p ? p->children() : mRootItems; QgsDataItem *item = items.value( row, nullptr );