mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-30 22:34:32 +00:00
Move 0 check to the top
This commit is contained in:
parent
f2dd080c14
commit
2386c9d1dc
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue