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
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/core/layertree/qgslayertreemodel.cpp
  2. +1 −1 src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
@@ -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.