From 644724d32cf832db895c4ed58a1e0ac31363077c Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 15 Mar 2016 16:55:11 +0100 Subject: [PATCH] ddraw: Just return an error if we failed to find the predecessor in ddraw_surface_delete_attached_surface(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/ddraw/surface.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 9e28655e791..3709b9413e6 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1982,16 +1982,16 @@ 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; attachment->next_attached = NULL;