Skip to content
Permalink
Browse files

Fix asserts when beginRemoveRows has no rows

This was hitting an assert in Qt Core
  • Loading branch information
elpaso committed Dec 12, 2017
1 parent 3da5ab6 commit d0a8891a05500d8439303a991cbb8e89ef82b4df
@@ -501,7 +501,7 @@ void QgsLayerTreeModel::refreshLayerLegend( QgsLayerTreeLayer *nodeLayer )

// update children
int oldNodeCount = rowCount( idx );
beginRemoveRows( idx, 0, oldNodeCount - 1 );
beginRemoveRows( idx, 0, std::max( oldNodeCount - 1, 0 ) );
removeLegendFromLayer( nodeLayer );
endRemoveRows();

@@ -58,7 +58,7 @@ void QgsCategorizedSymbolRendererModel::setRenderer( QgsCategorizedSymbolRendere
{
if ( mRenderer )
{
beginRemoveRows( QModelIndex(), 0, mRenderer->categories().size() - 1 );
beginRemoveRows( QModelIndex(), 0, std::max( mRenderer->categories().size() - 1, 0 ) );
mRenderer = nullptr;
endRemoveRows();
}

0 comments on commit d0a8891

Please sign in to comment.
You can’t perform that action at this time.