1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-26 20:13:10 +00:00

Fix UB in item view controller refocusing during redraw

See merge request OpenMW/openmw!4948

(cherry-picked from 081cf2cf25)
This commit is contained in:
Alexei Kotov 2025-10-18 18:55:03 +03:00
parent c5779d7021
commit c3f7c03249

View file

@ -82,7 +82,9 @@ namespace MWGui
if (Settings::gui().mControllerMenus)
{
mControllerFocus = std::clamp(mControllerFocus, 0, mItemCount - 1);
mControllerFocus = -1;
if (mItemCount > 0)
mControllerFocus = std::clamp(mControllerFocus, 0, mItemCount - 1);
updateControllerFocus(-1, mControllerFocus);
}