From ff9ba3f6e60fa30f52dd94e48214be5e1be1b28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 2 Sep 2022 20:44:24 +0200 Subject: Fix bug in EBMessageBox. g_hWnd being null did no harm, but g_window being null... --- c/win32.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'c') diff --git a/c/win32.cpp b/c/win32.cpp index f06f96c..ce1fc9d 100644 --- a/c/win32.cpp +++ b/c/win32.cpp @@ -88,8 +88,9 @@ static void CenterNextWindow(HWND hWnd) int EBMessageBox(const std::wstring_view text, const std::wstring_view caption, const UINT uType) { extern Window* g_window; - CenterNextWindow(g_window->hWnd); - return MessageBox(g_window->hWnd, text.data(), caption.data(), uType); + const HWND hWnd = g_window? g_window->hWnd: nullptr; + CenterNextWindow(hWnd); + return MessageBox(hWnd, text.data(), caption.data(), uType); } void ShowException(const wchar_t* const fmt, const wchar_t* const title, const UINT uType) noexcept -- cgit v1.2.3