From f4c7859fd8e746c60aa3b4eb50313eebf71e1045 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 2 Mar 2015 11:18:56 +0100 Subject: [PATCH] improved error tolerance of SDL native surface conversion --- src/libgame/sdl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 2217842e..e7e98505 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -207,11 +207,13 @@ boolean SDLSetNativeSurface(SDL_Surface **surface) SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface) { - if (surface == NULL || - backbuffer == NULL || - backbuffer->surface == NULL) + if (surface == NULL) return NULL; + if (backbuffer == NULL || + backbuffer->surface == NULL) + return SDL_ConvertSurface(surface, surface->format, 0); + return SDL_ConvertSurface(surface, backbuffer->surface->format, 0); } -- 2.34.1