diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index b1627b817f..c719b1c7f2 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1506,6 +1506,26 @@ BView::ScrollTo(BPoint where) // no reason to process this further if no scroll is intended. if (where.x == fBounds.left && where.y == fBounds.top) return; + + // make sure scrolling is within valid bounds + if (fHorScroller) { + float min, max; + fHorScroller->GetRange(&min, &max); + + if (where.x < min) + where.x = min; + else if (where.x > max) + where.x = max; + } + if (fVerScroller) { + float min, max; + fVerScroller->GetRange(&min, &max); + + if (where.y < min) + where.y = min; + else if (where.y > max) + where.y = max; + } _CheckLockAndSwitchCurrent();