From 1eb7d7013902dc8bbb7b84dc05e0dda4c2243c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 15 Aug 2022 22:17:16 +0200 Subject: Fix bug... If with init-statement makes me sad, because it is very confusing. --- c/main.cpp | 4 ++-- 1 file 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("GetDpiForWindow")) + auto GetDpiForWindow = lib? lib->GetProcAddress("GetDpiForWindow"): nullptr) g_dpi = GetDpiForWindow(hWnd); /* Load normal font. */ if (auto lib = Library::Maybe(L"User32.dll"); - lib->GetProcAddress("SystemParametersInfoW")) { + lib && lib->GetProcAddress("SystemParametersInfoW")) { NONCLIENTMETRICS m = {sizeof(NONCLIENTMETRICS)}; Require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &m, 0)); g_hfNormal = Require(CreateFontIndirect(&m.lfMessageFont)); -- cgit v1.2.3