https://git.reactos.org/?p=reactos.git;a=commitdiff;h=261416ddb94384fca091d…
commit 261416ddb94384fca091d3a6cf123bb247ce24f6
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Aug 25 14:19:50 2022 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Thu Aug 25 14:19:50 2022 +0900
[KBSWITCH] Follow-up of 0991ced
- Used FW_NORMAL.
- Added NULL checks.
CORE-10667
---
base/applications/kbswitch/kbswitch.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/base/applications/kbswitch/kbswitch.c
b/base/applications/kbswitch/kbswitch.c
index aad89ed481a..c931aee98f5 100644
--- a/base/applications/kbswitch/kbswitch.c
+++ b/base/applications/kbswitch/kbswitch.c
@@ -169,13 +169,31 @@ CreateTrayIcon(LPTSTR szLCID)
hdc = CreateCompatibleDC(NULL);
hbmColor = CreateCompatibleBitmap(hdc, CX_ICON, CY_ICON);
hbmMono = CreateBitmap(CX_ICON, CY_ICON, 1, 1, NULL);
+ if (!hdc || !hbmColor || !hbmMono)
+ {
+ if (hdc)
+ DeleteDC(hdc);
+ if (hbmColor)
+ DeleteObject(hbmColor);
+ if (hbmMono)
+ DeleteObject(hbmMono);
+ return NULL;
+ }
/* Create a font */
ZeroMemory(&lf, sizeof(lf));
lf.lfHeight = -11;
lf.lfCharSet = ANSI_CHARSET;
+ lf.lfWeight = FW_NORMAL;
StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), _T("Tahoma"));
hFont = CreateFontIndirect(&lf);
+ if (!hFont)
+ {
+ DeleteDC(hdc);
+ DeleteObject(hbmColor);
+ DeleteObject(hbmMono);
+ return NULL;
+ }
SetRect(&rect, 0, 0, CX_ICON, CY_ICON);