aboutsummaryrefslogtreecommitdiff
path: root/c/win32.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-09-02 20:44:24 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-09-02 20:44:24 +0200
commitff9ba3f6e60fa30f52dd94e48214be5e1be1b28a (patch)
treed93d65597f01a0375a404b2fd5de4296f4665883 /c/win32.cpp
parentbc4cef92d8efbf97a9215122abc2d7247c287f12 (diff)
downloadEpisodeBrowser-ff9ba3f6e60fa30f52dd94e48214be5e1be1b28a.tar.gz
Fix bug in EBMessageBox.
g_hWnd being null did no harm, but g_window being null...
Diffstat (limited to 'c/win32.cpp')
-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