Skip to content

Commit

Permalink
Avoid crash in style model when adding symbols with a new tag to library
Browse files Browse the repository at this point in the history
Fixes #20256
  • Loading branch information
nyalldawson committed Oct 30, 2018
1 parent 5ebb974 commit f6aecd1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/symbology/qgsstylemodel.cpp
Expand Up @@ -57,8 +57,8 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const

const bool isColorRamp = index.row() >= mStyle->symbolCount();
const QString name = !isColorRamp
? mSymbolNames.at( index.row() )
: mRampNames.at( index.row() - mSymbolNames.size() );
? mSymbolNames.value( index.row() )
: mRampNames.value( index.row() - mSymbolNames.size() );

switch ( role )
{
Expand Down Expand Up @@ -187,8 +187,8 @@ bool QgsStyleModel::setData( const QModelIndex &index, const QVariant &value, in
{
const bool isColorRamp = index.row() >= mStyle->symbolCount();
const QString name = !isColorRamp
? mSymbolNames.at( index.row() )
: mRampNames.at( index.row() - mSymbolNames.size() );
? mSymbolNames.value( index.row() )
: mRampNames.value( index.row() - mSymbolNames.size() );
const QString newName = value.toString();

return isColorRamp
Expand Down

0 comments on commit f6aecd1

Please sign in to comment.