mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-29 17:04:29 +00:00
Clamp index before subtracting
This commit is contained in:
parent
447e01504e
commit
f2dd080c14
1 changed files with 1 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ size_t MWGui::wrap(size_t index, size_t max, int delta)
|
|||
return index + absDelta;
|
||||
}
|
||||
size_t absDelta = static_cast<size_t>(-static_cast<ptrdiff_t>(delta));
|
||||
index = std::min(index, max);
|
||||
if (index >= absDelta)
|
||||
return index - absDelta;
|
||||
else if (max == 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue