ddraw: Just return an error if we failed to find the predecessor in ddraw_surface_delete_attached_surface().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-03-15 16:55:11 +01:00 committed by Alexandre Julliard
parent 130bd9d8c7
commit 644724d32c
1 changed files with 7 additions and 7 deletions

View File

@ -1982,15 +1982,15 @@ static HRESULT ddraw_surface_delete_attached_surface(struct ddraw_surface *surfa
}
/* Find the predecessor of the detached surface */
while (prev)
while (prev->next_attached != attachment)
{
if (prev->next_attached == attachment)
break;
prev = prev->next_attached;
if (!(prev = prev->next_attached))
{
ERR("Failed to find predecessor of %p.\n", attachment);
wined3d_mutex_unlock();
return DDERR_SURFACENOTATTACHED;
}
}
/* There must be a surface, otherwise there's a bug */
assert(prev);
/* Unchain the surface */
prev->next_attached = attachment->next_attached;