[KBSWITCH] Simplify checking NULLs

CORE-10667
This commit is contained in:
Katayama Hirofumi MZ 2022-08-28 09:48:56 +09:00
parent 0aa9d9fdb7
commit 43108ba763

View file

@ -169,16 +169,6 @@ 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));
@ -187,11 +177,18 @@ CreateTrayIcon(LPTSTR szLCID)
lf.lfWeight = FW_NORMAL;
StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), _T("Tahoma"));
hFont = CreateFontIndirect(&lf);
if (!hFont)
/* Checking NULL */
if (!hdc || !hbmColor || !hbmMono || !hFont)
{
DeleteDC(hdc);
DeleteObject(hbmColor);
DeleteObject(hbmMono);
if (hdc)
DeleteDC(hdc);
if (hbmColor)
DeleteObject(hbmColor);
if (hbmMono)
DeleteObject(hbmMono);
if (hFont)
DeleteObject(hFont);
return NULL;
}