Skip to content

Commit

Permalink
Check for model items size before removing rows
Browse files Browse the repository at this point in the history
This was hitting an assert in Qt core libraries 5.9.3
  • Loading branch information
elpaso committed Jan 26, 2018
1 parent ac4be1b commit d4e8f63
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit d4e8f63

Please sign in to comment.