Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9033 from mhugo/fix_20831
Fix "Allow null" in range widget (fixes #20831)
  • Loading branch information
Hugo Mercier committed Jan 30, 2019
2 parents 3769faa + eb5a336 commit fa1f876
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/editorwidgets/qgsrangewidgetwrapper.cpp
Expand Up @@ -146,7 +146,12 @@ void QgsRangeWidgetWrapper::initWidget( QWidget *editor )
if ( allowNull )
{
int stepval = step.isValid() ? step.toInt() : 1;
minval -= stepval;
int newMinval = minval - stepval;
// make sure there is room for a new value (i.e. signed integer does not overflow)
if ( newMinval < minval )
{
minval = newMinval;
}
mIntSpinBox->setValue( minval );
QgsSpinBox *intSpinBox( qobject_cast<QgsSpinBox *>( mIntSpinBox ) );
if ( intSpinBox )
Expand Down

0 comments on commit fa1f876

Please sign in to comment.