diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index b1c490f757..9e85fc8eb7 100644
--- a/projects/openrct2.vcxproj
+++ b/projects/openrct2.vcxproj
@@ -193,4 +193,4 @@
-
+
\ No newline at end of file
diff --git a/src/game.c b/src/game.c
index 945d1f7dc9..55cb5728d5 100644
--- a/src/game.c
+++ b/src/game.c
@@ -629,7 +629,6 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
if (w != NULL) {
windowClass = w->classification;
windowNumber = w->number;
- widget = &w->widgets[widgetIndex];
}
window_close_by_id(WC_ERROR, 0);
@@ -643,6 +642,8 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
if (widgetIndex == -1)
return;
+ widget = &w->widgets[widgetIndex];
+
switch (widget->type) {
case WWT_FRAME:
case WWT_RESIZE: