Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e90fb78

Browse files
nyalldawsongithub-actions[bot]
authored andcommittedMar 29, 2023
Fix crash when stored scale list contains invalid values
Can happen as a result of invalid settings being written by QGIS 3.30.0
1 parent 2f34f97 commit e90fb78

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎src/gui/qgsscalecombobox.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ void QgsScaleComboBox::updateScales( const QStringList &scales )
6060
}
6161
}
6262

63-
QStringList parts;
64-
double denominator;
65-
bool ok;
6663
for ( int i = 0; i < myScalesList.size(); ++i )
6764
{
68-
parts = myScalesList[ i ] .split( ':' );
69-
denominator = QLocale().toDouble( parts[1], &ok );
65+
const QStringList parts = myScalesList[ i ] .split( ':' );
66+
if ( parts.size() < 2 )
67+
continue;
68+
69+
bool ok = false;
70+
const double denominator = QLocale().toDouble( parts[1], &ok );
7071
if ( ok )
7172
{
7273
myScalesList[ i ] = toString( denominator );

0 commit comments

Comments
 (0)
Please sign in to comment.