From 840d53c28386a92821ce40880fd18fddfcc97e3f Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 5 Mar 2017 02:06:22 -0600 Subject: [PATCH] Merge pull request #1959 from Areloch/SDLSplashScreenCleanupSanity Does better sanity checking on cleanup for the splash screen closing in SDL --- .../windowManager/sdl/sdlSplashScreen.cpp | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Engine/source/windowManager/sdl/sdlSplashScreen.cpp b/Engine/source/windowManager/sdl/sdlSplashScreen.cpp index 1cf2440af..08d095d5c 100644 --- a/Engine/source/windowManager/sdl/sdlSplashScreen.cpp +++ b/Engine/source/windowManager/sdl/sdlSplashScreen.cpp @@ -103,10 +103,26 @@ bool Platform::displaySplashWindow( String path ) bool Platform::closeSplashWindow() { - SDL_DestroyTexture(gSplashTexture); - SDL_FreeSurface(gSplashImage); - SDL_DestroyRenderer(gSplashRenderer); - SDL_DestroyWindow(gSplashWindow); + if (gSplashTexture != nullptr) + { + SDL_DestroyTexture(gSplashTexture); + gSplashTexture = nullptr; + } + if (gSplashImage != nullptr) + { + SDL_FreeSurface(gSplashImage); + gSplashImage = nullptr; + } + if (gSplashRenderer != nullptr) + { + SDL_DestroyRenderer(gSplashRenderer); + gSplashRenderer = nullptr; + } + if (gSplashWindow != nullptr) + { + SDL_DestroyWindow(gSplashWindow); + gSplashWindow = nullptr; + } return true; } \ No newline at end of file