mirror of
https://github.com/reactos/reactos.git
synced 2026-07-06 04:44:29 +08:00
Handle PALETTE_LockPalette returning NULL.
Fixes Coverity CIDs 486 and 487. svn path=/trunk/; revision=36578
This commit is contained in:
@@ -62,6 +62,13 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color
|
||||
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
|
||||
|
||||
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
|
||||
if (PalGDI == NULL)
|
||||
{
|
||||
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||
DC_UnlockDc(dc);
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (Index = StartIndex;
|
||||
Index < StartIndex + Entries && Index < PalGDI->NumColors;
|
||||
@@ -120,6 +127,13 @@ IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors)
|
||||
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
|
||||
|
||||
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
|
||||
if (PalGDI == NULL)
|
||||
{
|
||||
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||
DC_UnlockDc(dc);
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (Index = StartIndex;
|
||||
Index < StartIndex + Entries && Index < PalGDI->NumColors;
|
||||
|
||||
Reference in New Issue
Block a user