ddraw: Do not crash, when Clipper is NULL

Detlef Riekenberg wine.dev at web.de
Sun May 27 18:08:01 CDT 2007


Age of Empires (1) called IDirectDrawSurfaceImpl_SetClipper
with Clipper == NULL and crashed.

We need to check This->clipper, before we access 
This->clipper->wineD3DClipper.


Changelog:
ddraw: Do not crash, when Clipper is NULL


-- 
 
By by ... Detlef

-------------- next part --------------
>From af77fb7af5ca50a274b243636cba55a4944d94cc Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Mon, 28 May 2007 01:02:38 +0200
Subject: [PATCH] ddraw: Do not crash, when Clipper is NULL
---
 dlls/ddraw/surface.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 62edb21..d3ebc84 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -1981,7 +1981,7 @@ IDirectDrawSurfaceImpl_SetClipper(IDirec
     if(oldClipper)
         IDirectDrawClipper_Release(ICOM_INTERFACE(oldClipper, IDirectDrawClipper));
 
-    return IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper->wineD3DClipper);
+    return IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL);
 }
 
 /*****************************************************************************
-- 
1.4.1



More information about the wine-patches mailing list