From f0e159b32aa5e32b9d6f7a5cad8c19c352261beb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 27 Sep 2009 22:29:13 +0000 Subject: [PATCH] Improved bug #759 Don't crash if creating the X image failed. --HG-- branch : SDL-1.2 extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%403924 --- src/video/x11/SDL_x11video.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 25b51151d..e97d31ec6 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -1196,7 +1196,10 @@ SDL_Surface *X11_SetVideoMode(_THIS, SDL_Surface *current, current->w = width; current->h = height; current->pitch = SDL_CalculatePitch(current); - X11_ResizeImage(this, current, flags); + if (X11_ResizeImage(this, current, flags) < 0) { + current = NULL; + goto done; + } } /* Clear these flags and set them only if they are in the new set. */