Skip to content

Commit

Permalink
Fix unreported crash when and empty scale is in the settings
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and github-actions[bot] committed Apr 5, 2023
1 parent 0e419a3 commit cd7e1dc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/gui/qgsscalecombobox.cpp
Expand Up @@ -55,6 +55,8 @@ void QgsScaleComboBox::updateScales( const QStringList &scales )
}
}

QStringList myCleanedScalesList;

for ( int i = 0; i < myScalesList.size(); ++i )
{
const QStringList parts = myScalesList[ i ] .split( ':' );
Expand All @@ -65,13 +67,21 @@ void QgsScaleComboBox::updateScales( const QStringList &scales )
const double denominator = QLocale().toDouble( parts[1], &ok );
if ( ok )
{
myScalesList[ i ] = toString( denominator );
myCleanedScalesList.push_back( toString( denominator ) );
}
else
{
const double denominator = parts[1].toDouble( &ok );
if ( ok )
{
myCleanedScalesList.push_back( toString( denominator ) );
}
}
}

blockSignals( true );
clear();
addItems( myScalesList );
addItems( myCleanedScalesList );
setScaleString( oldScale );
blockSignals( false );
}
Expand Down

0 comments on commit cd7e1dc

Please sign in to comment.