mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Fix #23655: Crash with invalid widget index
This commit is contained in:
parent
5bec62c540
commit
e454f27518
1 changed files with 3 additions and 2 deletions
|
@ -290,7 +290,7 @@ namespace OpenRCT2
|
|||
|
||||
// Get window and widget under cursor position
|
||||
w = windowMgr->FindFromPoint(screenCoords);
|
||||
widgetIndex = w == nullptr ? -1 : windowMgr->FindWidgetFromPoint(*w, screenCoords);
|
||||
widgetIndex = w == nullptr ? kWidgetIndexNull : windowMgr->FindWidgetFromPoint(*w, screenCoords);
|
||||
widget = widgetIndex == kWidgetIndexNull ? nullptr : &w->widgets[widgetIndex];
|
||||
|
||||
switch (_inputState)
|
||||
|
@ -1557,7 +1557,8 @@ namespace OpenRCT2
|
|||
{
|
||||
if (gTooltipCursor == screenCoords)
|
||||
{
|
||||
if (gCurrentRealTimeTicks >= _tooltipNotShownTimeout && w != nullptr && WidgetIsVisible(*w, widgetIndex))
|
||||
if (gCurrentRealTimeTicks >= _tooltipNotShownTimeout && w != nullptr && widgetIndex != kWidgetIndexNull
|
||||
&& WidgetIsVisible(*w, widgetIndex))
|
||||
{
|
||||
gTooltipCloseTimeout = gCurrentRealTimeTicks + 8000;
|
||||
WindowTooltipOpen(w, widgetIndex, screenCoords);
|
||||
|
|
Loading…
Reference in a new issue