Don't crash when calling DirectDrawSurface::EnumAttachedSurfaces on a

surface with no attached surfaces.
This commit is contained in:
James Abbatiello 2000-08-22 20:38:00 +00:00 committed by Alexandre Julliard
parent dbdd94ba4b
commit ba0a533669
1 changed files with 6 additions and 4 deletions

View File

@ -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;i<chain->nrofsurfaces;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;i<chain->nrofsurfaces;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;
}