Skip to content
Permalink
Browse files

Be permissive when parsing ranges from user input

  • Loading branch information
elpaso committed Sep 1, 2018
1 parent bb01ef3 commit 715707669b26b39ab56dd15c2db07a647d117148
Showing with 16 additions and 5 deletions.
  1. +16 −5 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
@@ -1013,8 +1013,13 @@ void QgsGraduatedSymbolRendererWidget::changeRange( int rangeIdx )

if ( dialog.exec() == QDialog::Accepted )
{
double lowerValue = dialog.lowerValue().toDouble();
double upperValue = dialog.upperValue().toDouble();
bool ok = false;
double lowerValue = qgsPermissiveToDouble( dialog.lowerValue(), ok );
if ( ! ok )
lowerValue = 0.0;
double upperValue = qgsPermissiveToDouble( dialog.upperValue(), ok );
if ( ! ok )
upperValue = 0.0;
mRenderer->updateRangeUpperValue( rangeIdx, upperValue );
mRenderer->updateRangeLowerValue( rangeIdx, lowerValue );

@@ -1138,9 +1143,15 @@ QList<QgsSymbol *> QgsGraduatedSymbolRendererWidget::selectedSymbols()
{
continue;
}

double lowerBound = list.at( 0 ).toDouble();
double upperBound = list.at( 2 ).toDouble();
// Not strictly necessary because the range should have been sanitized already
// after user input, but being permissive never hurts
bool ok = false;
double lowerBound = qgsPermissiveToDouble( list.at( 0 ), ok );
if ( ! ok )
lowerBound = 0.0;
double upperBound = qgsPermissiveToDouble( list.at( 2 ), ok );
if ( ! ok )
upperBound = 0.0;
QgsSymbol *s = findSymbolForRange( lowerBound, upperBound, ranges );
if ( s )
{

0 comments on commit 7157076

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