mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-29 07:04:35 +01:00
Fix: Odd drawing and crash if scrollbar is not tall enough. (#14052)
Under certain conditions the scrollbar "tab" could be too large for the scrollbar, and cause issues. Caused by an off-by-one in height calculation.
This commit is contained in:
@@ -2315,7 +2315,7 @@ static void HandleScrollbarScrolling(Window *w)
|
||||
int range = sb->GetCount() - sb->GetCapacity();
|
||||
if (range <= 0) return;
|
||||
|
||||
int pos = RoundDivSU((i + _scrollbar_start_pos) * range, _scrollbar_size);
|
||||
int pos = RoundDivSU((i + _scrollbar_start_pos) * range, std::max(1, _scrollbar_size));
|
||||
if (rtl) pos = range - pos;
|
||||
if (sb->SetPosition(pos)) w->SetDirty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user