Skip to content
Permalink
Browse files

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

Fixes #20256

(cherry picked from commit f6aecd1)
  • Loading branch information
nyalldawson committed Oct 30, 2018
1 parent ac1fa9e commit c3ddce1248c79d87633a8d2a4bc6eaa592493f66
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 c3ddce1

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