From ebd4e8f5d6aa11f1f3a000cd87e22d67c35ac137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 30 Nov 2018 23:32:55 +0100 Subject: [PATCH] Provide more checks when handling possibly-gone windows (#8331) --- src/openrct2-ui/windows/TextInput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 6e1732bc02..89c434c9ef 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -292,9 +292,13 @@ void window_text_input_key(rct_window* w, char keychar) // ecx when nonzero means text input success if (w) window_event_textinput_call(w, calling_widget, text_input); + + // Update the window pointer, as it may have been closed by textinput handler + w = window_find_by_number(calling_class, calling_number); } - window_invalidate(w); + if (w) + window_invalidate(w); } void window_text_input_update7(rct_window* w)