GUI2 Canvas: Don't try to destroy a null renderer

The move constructor just above sets renderer_ to null, and SDL_DestroyRenderer() may not be called on a nullptr.

Fixes an assertion failure under xmonad: https://github.com/wesnoth/wesnoth/issues/3716#issuecomment-452291506
This commit is contained in:
josteph 2019-01-09 20:02:14 +00:00
parent d6d0fcf570
commit e0fe47a6e2

View File

@ -1379,7 +1379,8 @@ canvas::canvas(canvas&& c)
canvas::~canvas()
{
SDL_DestroyRenderer(renderer_);
if(renderer_)
SDL_DestroyRenderer(renderer_);
}
void canvas::draw(const bool force)