aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl
diff options
context:
space:
mode:
authorColin Snover2017-11-15 11:33:27 -0600
committerColin Snover2017-11-15 11:36:14 -0600
commit9bbf7f3f363465765787819de2c93dd97a629bef (patch)
tree9b42137cc79be7c543d7bb1f9bcfe2ab986aadcf /backends/graphics/surfacesdl
parent74612b40f79e3ffd12c4e21323052a4204f66013 (diff)
downloadscummvm-rg350-9bbf7f3f363465765787819de2c93dd97a629bef.tar.gz
scummvm-rg350-9bbf7f3f363465765787819de2c93dd97a629bef.tar.bz2
scummvm-rg350-9bbf7f3f363465765787819de2c93dd97a629bef.zip
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.
Diffstat (limited to 'backends/graphics/surfacesdl')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp6
1 files changed, 4 insertions, 2 deletions
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;
}