From 2386c9d1dc1d871753c74e50e1146f383f034919 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 15 Nov 2025 11:03:56 +0100 Subject: [PATCH] Move 0 check to the top --- apps/openmw/mwgui/windowbase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/windowbase.cpp b/apps/openmw/mwgui/windowbase.cpp index 71c3db24a9..82053e6197 100644 --- a/apps/openmw/mwgui/windowbase.cpp +++ b/apps/openmw/mwgui/windowbase.cpp @@ -17,6 +17,8 @@ using namespace MWGui; size_t MWGui::wrap(size_t index, size_t max, int delta) { + if (max == 0) + return 0; if (delta >= 0) { unsigned absDelta = static_cast(delta); @@ -30,8 +32,6 @@ size_t MWGui::wrap(size_t index, size_t max, int delta) index = std::min(index, max); if (index >= absDelta) return index - absDelta; - else if (max == 0) - return 0; return max - 1; }