Skip to content
Permalink
Browse files

Merge pull request #6181 from elpaso/check-for-size-before-adding-to-…

…model

Check for model items size before removing rows
  • Loading branch information
elpaso committed Jan 26, 2018
2 parents ac4be1b + d4e8f63 commit bd6a1fa20391c8c09f811c26c1ffa686f9cb4237
Showing with 20 additions and 6 deletions.
  1. +20 −6 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
@@ -55,15 +55,29 @@ void QgsGraduatedSymbolRendererModel::setRenderer( QgsGraduatedSymbolRenderer *r
{
if ( mRenderer )
{
beginRemoveRows( QModelIndex(), 0, mRenderer->ranges().size() - 1 );
mRenderer = nullptr;
endRemoveRows();
if ( mRenderer->ranges().size() )
{
beginRemoveRows( QModelIndex(), 0, mRenderer->ranges().size() - 1 );
mRenderer = nullptr;
endRemoveRows();
}
else
{
mRenderer = nullptr;
}
}
if ( renderer )
{
beginInsertRows( QModelIndex(), 0, renderer->ranges().size() - 1 );
mRenderer = renderer;
endInsertRows();
if ( renderer->ranges().size() )
{
beginInsertRows( QModelIndex(), 0, renderer->ranges().size() - 1 );
mRenderer = renderer;
endInsertRows();
}
else
{
mRenderer = renderer;
}
}
}

0 comments on commit bd6a1fa

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