Skip to content

Commit 6d914c9

Browse files
committed
FIX: possible use of uninitialized variable
1 parent 17cd373 commit 6d914c9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/os/win32/host-window.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -497,20 +497,23 @@ void Paint_Window(HWND window);
497497
if (!Default_Font) {
498498
LOGFONTW font;
499499
HTHEME *hTheme = NULL;
500-
HRESULT res = -1;
500+
HRESULT err = E_FAIL;
501501
if (IsThemeActive()) {
502502
hTheme = OpenThemeData(window, L"Window");
503503
if (hTheme) {
504-
res = GetThemeSysFont(hTheme, TMT_MSGBOXFONT, &font);
504+
err = GetThemeSysFont(hTheme, TMT_MSGBOXFONT, &font);
505505
}
506-
} else {
506+
}
507+
if (err != S_OK) {
507508
NONCLIENTMETRICS metrics;
508509
ZeroMemory(&metrics, sizeof(metrics));
509510
metrics.cbSize = sizeof(metrics);
510-
res = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
511-
if (res) font = metrics.lfMessageFont;
511+
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0)) {
512+
font = metrics.lfMessageFont;
513+
err = S_OK;
514+
}
512515
}
513-
if ( res >= 0 ) {
516+
if (err == S_OK) {
514517
Default_Font = CreateFontIndirect(&font);
515518
}
516519

0 commit comments

Comments
 (0)