Fix browser model issue identified by model test

This commit is contained in:
Nyall Dawson 2016-02-03 08:33:50 +11:00
parent d4ea95ea49
commit c6c8277ec8

View File

@ -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<QgsDataItem*> &items = p ? p->children() : mRootItems;
QgsDataItem *item = items.value( row, nullptr );