[Scummvm-git-logs] scummvm master -> 94e2c674186744db55f548032f889f8e122b9c97

csnover csnover at users.noreply.github.com
Thu Dec 1 20:11:02 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
94e2c67418 GUI: Fix crash when slider values are out-of-bounds


Commit: 94e2c674186744db55f548032f889f8e122b9c97
    https://github.com/scummvm/scummvm/commit/94e2c674186744db55f548032f889f8e122b9c97
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-01T13:04:55-06:00

Commit Message:
GUI: Fix crash when slider values are out-of-bounds

Out-of-bounds values are always indicative of a bug somewhere else,
but at least not crashing here allows the user to recover by
interacting with the slider control. The error will still be
obvious because the associated text field will display the
original weird value.

Changed paths:
    gui/widget.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index 898d567..850fad0 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -701,10 +701,12 @@ void SliderWidget::drawWidget() {
 }
 
 int SliderWidget::valueToBarWidth(int value) {
+	value = CLIP(value, _valueMin, _valueMax);
 	return (_w * (value - _valueMin) / (_valueMax - _valueMin));
 }
 
 int SliderWidget::valueToPos(int value) {
+	value = CLIP(value, _valueMin, _valueMax);
 	return ((_w - 1) * (value - _valueMin + 1) / (_valueMax - _valueMin));
 }
 





More information about the Scummvm-git-logs mailing list