From 56c0bb8bf2d7b68228be15423d5656e72c111b31 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Sat, 10 Jul 1999 10:10:43 +0000 Subject: [PATCH] Fixed crash due to invalid GDI_Obj. --- graphics/x11drv/palette.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphics/x11drv/palette.c b/graphics/x11drv/palette.c index 8657ed81893..320cd96ef42 100644 --- a/graphics/x11drv/palette.c +++ b/graphics/x11drv/palette.c @@ -660,6 +660,9 @@ int X11DRV_PALETTE_ToPhysical( DC *dc, COLORREF color ) unsigned char spec_type = color >> 24; PALETTEOBJ* palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC ); + /* palPtr can be NULL when DC is being destroyed */ + if( !palPtr ) return 0; + if ( X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED ) { /* there is no colormap limitation; we are going to have to compute @@ -724,10 +727,7 @@ int X11DRV_PALETTE_ToPhysical( DC *dc, COLORREF color ) else { - /* palPtr can be NULL when DC is being destroyed */ - - if( !palPtr ) return 0; - else if( !palPtr->mapping ) + if( !palPtr->mapping ) WARN("Palette %04x is not realized\n", dc->w.hPalette); switch(spec_type) /* we have to peruse DC and system palette */