H. Verbeet : d3d: Don't crash when SetRenderTarget() is called with a NULL pSurface.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 7 07:13:05 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 7ac5bd67d561ac9921fc7dd9e5072a94301e2a25
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=7ac5bd67d561ac9921fc7dd9e5072a94301e2a25

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Sat Aug  5 23:41:29 2006 +0200

d3d: Don't crash when SetRenderTarget() is called with a NULL pSurface.

---

 dlls/d3d8/device.c |    2 +-
 dlls/d3d9/device.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 18ea822..1d12290 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -579,7 +579,7 @@ static HRESULT WINAPI IDirect3DDevice8Im
 
     IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, NULL == pZSurface ? NULL : (IWineD3DSurface *)pZSurface->wineD3DSurface);
 
-    return IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, (IWineD3DSurface *)pSurface->wineD3DSurface);
+    return IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface ? (IWineD3DSurface *)pSurface->wineD3DSurface : NULL);
 }
 
 static HRESULT  WINAPI  IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppRenderTarget) {
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 7aac0e4..ad415a8 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -380,7 +380,7 @@ static HRESULT  WINAPI  IDirect3DDevice9
     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pRenderTarget;
     TRACE("(%p) Relay\n" , This);
-    return IWineD3DDevice_SetRenderTarget(This->WineD3DDevice,RenderTargetIndex,(IWineD3DSurface*)pSurface->wineD3DSurface);
+    return IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex, pSurface ? (IWineD3DSurface*)pSurface->wineD3DSurface : NULL);
 }
 
 static HRESULT  WINAPI  IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget) {




More information about the wine-cvs mailing list