From 36ac558466f4fe264b725975ea27935e4aeec4d9 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sat, 5 Mar 2016 01:30:57 +0100 Subject: [PATCH] fix crash with nogui on windows --- src/desktop/windows_tray_notification.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/desktop/windows_tray_notification.cpp b/src/desktop/windows_tray_notification.cpp index d3f3d88a6432..359ba801156f 100644 --- a/src/desktop/windows_tray_notification.cpp +++ b/src/desktop/windows_tray_notification.cpp @@ -193,8 +193,9 @@ HWND windows_tray_notification::get_window_handle() #if !SDL_VERSION_ATLEAST(2, 0, 0) if (SDL_GetWMInfo(&wmInfo) != 1) { #else + sdl::twindow* window = CVideo::get_singleton().get_window(); // SDL 1.2 keeps track of window handles internally whereas SDL 2.0 allows the caller control over which window to use - if (SDL_GetWindowWMInfo (static_cast (*CVideo::get_singleton().get_window()), &wmInfo) != SDL_TRUE) { + if (!window || SDL_GetWindowWMInfo (static_cast (*window), &wmInfo) != SDL_TRUE) { #endif return NULL; }