Skip to content

Commit

Permalink
Common: fix couple of GUI functions that may fail when restoring a save
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Oct 14, 2023
1 parent 41f2f6d commit b2859f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Common/gui/guimain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void GUIMain::NotifyControlState(int objid, bool mark_changed)
// Update cursor-over-control state, if necessary
const int overctrl = MouseOverCtrl;
if (!_polling &&
(objid >= 0) && (objid == overctrl) &&
(objid >= 0) && (objid == overctrl) && ((size_t)objid < _controls.size()) &&
(!_controls[overctrl]->IsClickable() ||
!_controls[overctrl]->IsVisible() ||
!_controls[overctrl]->IsEnabled()))
Expand All @@ -217,7 +217,7 @@ void GUIMain::ClearChanged()

void GUIMain::ResetOverControl()
{
if (MouseOverCtrl >= 0)
if ((MouseOverCtrl >= 0) && ((size_t)MouseOverCtrl < _controls.size()))
_controls[MouseOverCtrl]->OnMouseLeave();
// Force it to re-check for which control is under the mouse
MouseWasAt.X = -1;
Expand Down

0 comments on commit b2859f9

Please sign in to comment.