[PATCH] winex11.drv: added missing NULL check (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sat Jan 31 12:57:10 CST 2009
Hi,
CID 459, physDev can be NULL, so check for it and handle
it like non-existing index.
Ciao, Marcus
---
dlls/winex11.drv/palette.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c
index 356cb95..f7dba05 100644
--- a/dlls/winex11.drv/palette.c
+++ b/dlls/winex11.drv/palette.c
@@ -895,7 +895,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
switch(spec_type)
{
case 0x10: /* DIBINDEX */
- if( GetDIBColorTable( physDev->hdc, idx, 1, &quad ) != 1 ) {
+ if( physDev && (GetDIBColorTable( physDev->hdc, idx, 1, &quad ) != 1 )) {
WARN("DIBINDEX(%x) : idx %d is out of bounds, assuming black\n", color , idx);
return 0;
}
@@ -929,7 +929,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
return (((color >> 16) & 0xff) +
((color >> 8) & 0xff) + (color & 0xff) > 255*3/2) ? white : 1 - white;
}
-
+ break;
}
red = GetRValue(color); green = GetGValue(color); blue = GetBValue(color);
--
1.5.6
More information about the wine-patches
mailing list