Skip to content
Permalink
Browse files

Check for model items size before removing rows

This was hitting an assert in Qt core libraries 5.9.3
  • Loading branch information
elpaso committed Jan 26, 2018
1 parent ac4be1b commit d4e8f63315cc681c83b5cf47eab02c113e0d5601
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 d4e8f63

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