diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-02 20:44:24 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-02 20:44:24 +0200 |
commit | ff9ba3f6e60fa30f52dd94e48214be5e1be1b28a (patch) | |
tree | d93d65597f01a0375a404b2fd5de4296f4665883 | |
parent | bc4cef92d8efbf97a9215122abc2d7247c287f12 (diff) | |
download | EpisodeBrowser-ff9ba3f6e60fa30f52dd94e48214be5e1be1b28a.tar.gz |
Fix bug in EBMessageBox.
g_hWnd being null did no harm, but g_window being null...
-rw-r--r-- | c/win32.cpp | 5 |
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 |