From 9bbf7f3f363465765787819de2c93dd97a629bef Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 15 Nov 2017 11:33:27 -0600 Subject: SDL: Don't pass null pointers to SDL_DestroyTexture/SDL_DestroyRenderer SDL does not like this and will raise an assertion when built with internal SDL assertions turned on. With internal assertions turned off, it will still call SDL_SetError any time a null pointer is passed, though it will not raise an assertion or crash. --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'backends/graphics/surfacesdl') diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 6d3b3c4750..c2e0fd20e4 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -2656,10 +2656,12 @@ void SurfaceSdlGraphicsManager::notifyResize(const int width, const int height) #if SDL_VERSION_ATLEAST(2, 0, 0) void SurfaceSdlGraphicsManager::deinitializeRenderer() { - SDL_DestroyTexture(_screenTexture); + if (_screenTexture) + SDL_DestroyTexture(_screenTexture); _screenTexture = nullptr; - SDL_DestroyRenderer(_renderer); + if (_renderer) + SDL_DestroyRenderer(_renderer); _renderer = nullptr; } -- cgit v1.2.3