SDLPP: Save texture before rendering
In some cases texture might be changed after render() has been called but before renderer presented the render, causing errors.
This commit is contained in:
@@ -55,7 +55,8 @@ Texture::Texture( std::shared_ptr< Renderer > &renderer, Font &font,
|
||||
setTextureFromSurface( renderer, surface );
|
||||
}
|
||||
Texture::~Texture() {
|
||||
SDL_DestroyTexture( texture );
|
||||
if ( texture != nullptr )
|
||||
SDL_DestroyTexture( texture );
|
||||
}
|
||||
SDL_Texture *Texture::getTexturePtr() {
|
||||
return texture;
|
||||
|
||||
Reference in New Issue
Block a user