Don't allow setting a scrollbar position to nan.

Since nan != nan, the scrollbar would otherwise try to move the view to
the new position, the view would try to set the scrollbar value again,
and so on.
This commit is contained in:
Adrien Destugues
2013-01-25 22:17:59 +01:00
parent 79fd9dac6c
commit fdb61e9836
+3 -1
View File
@@ -379,6 +379,8 @@ BScrollBar::SetValue(float value)
value = fMax;
else if (value < fMin)
value = fMin;
else if(isnan(value))
return;
value = roundf(value);
@@ -408,7 +410,7 @@ BScrollBar::ValueChanged(float newValue)
{
TRACE("BScrollBar(%s)::ValueChanged(%.1f)\n", Name(), newValue);
if (fTarget) {
if (fTarget && newValue) {
// cache target bounds
BRect targetBounds = fTarget->Bounds();
// if vertical, check bounds top and scroll if different from newValue