ddraw: Check for the Palette before using it

André Hentschel nerv at dawncrow.de
Mon Feb 28 14:29:47 CST 2011


http://bugs2.winehq.org/attachment.cgi?id=33483
(from http://bugs.winehq.org/show_bug.cgi?id=26264)
---
 dlls/ddraw/surface.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index dca4014..024604e 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -2736,7 +2736,8 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir
     if (wined3d_palette)
     {
         *Pal = wined3d_palette_get_parent(wined3d_palette);
-        IDirectDrawPalette_AddRef(*Pal);
+        if (*Pal) IDirectDrawPalette_AddRef(*Pal);
+        else hr = DDERR_NOPALETTEATTACHED;
     }
     else
     {
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list