mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-30 06:04:33 +00:00
Fix UB in item view controller refocusing during redraw (#8724)
std::clamp's upper bound goes negative when there are no items
This commit is contained in:
parent
3f6ecc4de1
commit
1afbc6ba63
1 changed files with 3 additions and 1 deletions
|
|
@ -82,6 +82,8 @@ namespace MWGui
|
||||||
|
|
||||||
if (Settings::gui().mControllerMenus)
|
if (Settings::gui().mControllerMenus)
|
||||||
{
|
{
|
||||||
|
mControllerFocus = -1;
|
||||||
|
if (mItemCount > 0)
|
||||||
mControllerFocus = std::clamp(mControllerFocus, 0, mItemCount - 1);
|
mControllerFocus = std::clamp(mControllerFocus, 0, mItemCount - 1);
|
||||||
updateControllerFocus(-1, mControllerFocus);
|
updateControllerFocus(-1, mControllerFocus);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue