mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[KBSWITCH] Simplify checking NULLs
CORE-10667
This commit is contained in:
parent
0aa9d9fdb7
commit
43108ba763
1 changed files with 11 additions and 14 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue