mirror of
https://github.com/reactos/reactos.git
synced 2024-08-13 06:37:06 +00:00
Handle PALETTE_LockPalette returning NULL.
Fixes Coverity CIDs 486 and 487. svn path=/trunk/; revision=36578
This commit is contained in:
parent
b3b0519142
commit
f1f31fe9f2
|
@ -62,6 +62,13 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color
|
||||||
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
|
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
|
||||||
|
|
||||||
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
|
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
|
||||||
|
if (PalGDI == NULL)
|
||||||
|
{
|
||||||
|
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||||
|
DC_UnlockDc(dc);
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (Index = StartIndex;
|
for (Index = StartIndex;
|
||||||
Index < StartIndex + Entries && Index < PalGDI->NumColors;
|
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;
|
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
|
||||||
|
|
||||||
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
|
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
|
||||||
|
if (PalGDI == NULL)
|
||||||
|
{
|
||||||
|
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||||
|
DC_UnlockDc(dc);
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (Index = StartIndex;
|
for (Index = StartIndex;
|
||||||
Index < StartIndex + Entries && Index < PalGDI->NumColors;
|
Index < StartIndex + Entries && Index < PalGDI->NumColors;
|
||||||
|
|
Loading…
Reference in a new issue