diff --git a/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp b/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp index bd802ef2356..18902d29669 100644 --- a/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp @@ -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( mIntSpinBox ) ); if ( intSpinBox )