Skip to content
Permalink
Browse files

Avoid crash in style model when adding symbols with a new tag to library

Fixes #20256
  • Loading branch information
nyalldawson committed Oct 30, 2018
1 parent 5ebb974 commit f6aecd152d367ed0a4cf661c3c5c8c1850f608af
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/symbology/qgsstylemodel.cpp
@@ -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 )
{
@@ -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

0 comments on commit f6aecd1

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