Controller cleanup pointer check

This commit is contained in:
scawful
2023-11-26 16:23:36 -05:00
parent b3fc57bd77
commit 185039f21a
2 changed files with 11 additions and 3 deletions

View File

@@ -33,8 +33,16 @@ class Controller : public ExperimentFlags {
private:
struct sdl_deleter {
void operator()(SDL_Window *p) const { SDL_DestroyWindow(p); }
void operator()(SDL_Renderer *p) const { SDL_DestroyRenderer(p); }
void operator()(SDL_Window *p) const {
if (p) {
SDL_DestroyWindow(p);
}
}
void operator()(SDL_Renderer *p) const {
if (p) {
SDL_DestroyRenderer(p);
}
}
void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); }
};