aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/win32.cpp5
1 files changed, 3 insertions, 2 deletions
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