From f2dd080c14ae588cbadb2afd6e5d1b56605a59b0 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Fri, 14 Nov 2025 16:45:32 +0100 Subject: [PATCH] Clamp index before subtracting --- apps/openmw/mwgui/windowbase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwgui/windowbase.cpp b/apps/openmw/mwgui/windowbase.cpp index 360602126a..71c3db24a9 100644 --- a/apps/openmw/mwgui/windowbase.cpp +++ b/apps/openmw/mwgui/windowbase.cpp @@ -27,6 +27,7 @@ size_t MWGui::wrap(size_t index, size_t max, int delta) return index + absDelta; } size_t absDelta = static_cast(-static_cast(delta)); + index = std::min(index, max); if (index >= absDelta) return index - absDelta; else if (max == 0)