diff tools/64vw.c @ 2102:e0281dae2cb8

Backed out changeset dcca36701cdd
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 07 Mar 2019 14:12:21 +0200
parents 4276b8c0fef0
children 2d0db1e6b4a7
line wrap: on
line diff
--- a/tools/64vw.c	Wed Mar 06 10:00:03 2019 +0200
+++ b/tools/64vw.c	Thu Mar 07 14:12:21 2019 +0200
@@ -546,10 +546,17 @@
     // Cleanup
     dmFree(optFilenames);
 
-    SDL_DestroyTexture(texture);
-    SDL_DestroyRenderer(renderer);
-    SDL_DestroyWindow(window);
-    SDL_FreeSurface(surf);
+    if (texture != NULL)
+        SDL_DestroyTexture(texture);
+
+    if (renderer != NULL)
+        SDL_DestroyRenderer(renderer);
+
+    if (window != NULL)
+        SDL_DestroyWindow(window);
+
+    if (surf != NULL)
+        SDL_FreeSurface(surf);
 
     if (initSDL)
         SDL_Quit();