From ba0a53366941bb2db0c0d36c7440eb9e303f4f23 Mon Sep 17 00:00:00 2001 From: James Abbatiello Date: Tue, 22 Aug 2000 20:38:00 +0000 Subject: [PATCH] Don't crash when calling DirectDrawSurface::EnumAttachedSurfaces on a surface with no attached surfaces. --- dlls/ddraw/dsurface/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/dsurface/main.c b/dlls/ddraw/dsurface/main.c index 700b4c7175b..e91473c7a92 100644 --- a/dlls/ddraw/dsurface/main.c +++ b/dlls/ddraw/dsurface/main.c @@ -867,10 +867,12 @@ HRESULT WINAPI IDirectDrawSurface4Impl_EnumAttachedSurfaces( struct _surface_chain *chain = This->s.chain; TRACE("(%p)->(%p,%p)\n",This,context,esfcb); - for (i=0;inrofsurfaces;i++) { - TRACE( "Enumerating attached surface (%p)\n", chain->surfaces[i]); - if (esfcb((LPDIRECTDRAWSURFACE) chain->surfaces[i], &(chain->surfaces[i]->s.surface_desc), context) == DDENUMRET_CANCEL) - return DD_OK; /* FIXME: return value correct? */ + if (chain) { + for (i=0;inrofsurfaces;i++) { + TRACE( "Enumerating attached surface (%p)\n", chain->surfaces[i]); + if (esfcb((LPDIRECTDRAWSURFACE) chain->surfaces[i], &(chain->surfaces[i]->s.surface_desc), context) == DDENUMRET_CANCEL) + return DD_OK; /* FIXME: return value correct? */ + } } return DD_OK; }