aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-15 22:17:16 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-15 22:17:16 +0200
commit1eb7d7013902dc8bbb7b84dc05e0dda4c2243c4f (patch)
treed770b3e15cf356a5eb6acc80e007297308fdafc3
parent16c355664bf27e5ec4be5e58bd83d9d1a4752a20 (diff)
downloadEpisodeBrowser-1eb7d7013902dc8bbb7b84dc05e0dda4c2243c4f.tar.gz
Fix bug...
If with init-statement makes me sad, because it is very confusing.
-rw-r--r--c/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 6878390..fb5764b 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -180,12 +180,12 @@ void InitializeMainWindow(const HWND hWnd)
/* Look up DPI. */
if (auto lib = Library::Maybe(L"User32.dll");
- auto GetDpiForWindow = lib->GetProcAddress<UINT(HWND)>("GetDpiForWindow"))
+ auto GetDpiForWindow = lib? lib->GetProcAddress<UINT(HWND)>("GetDpiForWindow"): nullptr)
g_dpi = GetDpiForWindow(hWnd);
/* Load normal font. */
if (auto lib = Library::Maybe(L"User32.dll");
- lib->GetProcAddress<void>("SystemParametersInfoW")) {
+ lib && lib->GetProcAddress<void>("SystemParametersInfoW")) {
NONCLIENTMETRICS m = {sizeof(NONCLIENTMETRICS)};
Require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &m, 0));
g_hfNormal = Require(CreateFontIndirect(&m.lfMessageFont));