Skip to content

Commit

Permalink
FIX: possible use of uninitialized variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jan 20, 2023
1 parent 17cd373 commit 6d914c9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/os/win32/host-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,20 +497,23 @@ void Paint_Window(HWND window);
if (!Default_Font) {
LOGFONTW font;
HTHEME *hTheme = NULL;
HRESULT res = -1;
HRESULT err = E_FAIL;
if (IsThemeActive()) {
hTheme = OpenThemeData(window, L"Window");
if (hTheme) {
res = GetThemeSysFont(hTheme, TMT_MSGBOXFONT, &font);
err = GetThemeSysFont(hTheme, TMT_MSGBOXFONT, &font);
}
} else {
}
if (err != S_OK) {
NONCLIENTMETRICS metrics;
ZeroMemory(&metrics, sizeof(metrics));
metrics.cbSize = sizeof(metrics);
res = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
if (res) font = metrics.lfMessageFont;
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0)) {
font = metrics.lfMessageFont;
err = S_OK;
}
}
if ( res >= 0 ) {
if (err == S_OK) {
Default_Font = CreateFontIndirect(&font);
}

Expand Down

0 comments on commit 6d914c9

Please sign in to comment.