Fix #13121: Crash when clicking on scrollbar if contents don't need scrolling. (#13122)

This commit is contained in:
Peter Nelson 2024-11-25 08:20:20 +00:00 committed by GitHub
parent 5b02f51e17
commit a3437df7b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2309,6 +2309,7 @@ static void HandleScrollbarScrolling(Window *w)
/* Find the item we want to move to. SetPosition will make sure it's inside bounds. */
int range = sb->GetCount() - sb->GetCapacity();
if (range <= 0) return;
int pos = RoundDivSU((i + _scrollbar_start_pos) * range, _scrollbar_size);
if (rtl) pos = range - pos;