From a3437df7b7c3676165d51e3bb3220acd8d05b6e1 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 25 Nov 2024 08:20:20 +0000 Subject: [PATCH] Fix #13121: Crash when clicking on scrollbar if contents don't need scrolling. (#13122) --- src/window.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/window.cpp b/src/window.cpp index bb3a9272cd..6c04c83727 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -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;