Guard against possible NULL dereference

This commit is contained in:
Michał Janiszewski committed 2015-10-27 18:32:39 +01:00
1 parent 680bb0c52b
commit 0cdaa0b57e
1 file changed
+3 -2
+3 -2
View File
@@ -1250,8 +1250,9 @@ static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y)
}
}
else {
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) != w->classification ||
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) != w->number ||
if (((w != NULL) &&
(RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) != w->classification ||
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) != w->number)) ||
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) != widgetIndex
) {
window_tooltip_close();