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)