1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-30 13:34:33 +00:00

Move 0 check to the top

This commit is contained in:
Evil Eye 2025-11-15 11:03:56 +01:00
parent f2dd080c14
commit 2386c9d1dc

View file

@ -17,6 +17,8 @@ using namespace MWGui;
size_t MWGui::wrap(size_t index, size_t max, int delta) size_t MWGui::wrap(size_t index, size_t max, int delta)
{ {
if (max == 0)
return 0;
if (delta >= 0) if (delta >= 0)
{ {
unsigned absDelta = static_cast<unsigned>(delta); unsigned absDelta = static_cast<unsigned>(delta);
@ -30,8 +32,6 @@ size_t MWGui::wrap(size_t index, size_t max, int delta)
index = std::min(index, max); index = std::min(index, max);
if (index >= absDelta) if (index >= absDelta)
return index - absDelta; return index - absDelta;
else if (max == 0)
return 0;
return max - 1; return max - 1;
} }