Handle PALETTE_LockPalette returning NULL.

Fixes Coverity CIDs 486 and 487.

svn path=/trunk/; revision=36578
This commit is contained in:
Gregor Schneider 2008-09-28 19:42:03 +00:00
parent b3b0519142
commit f1f31fe9f2

View file

@ -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;