diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index 05475dc9..4e80b72c 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -150,8 +150,8 @@ void Controller::OnInput() { void Controller::OnLoad() { PRINT_IF_ERROR(master_editor_.Update()); } void Controller::DoRender() const { - SDL_RenderClear(renderer_.get()); ImGui::Render(); + SDL_RenderClear(renderer_.get()); ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData()); SDL_RenderPresent(renderer_.get()); } diff --git a/src/app/core/controller.h b/src/app/core/controller.h index 95739ffd..3a6b9f86 100644 --- a/src/app/core/controller.h +++ b/src/app/core/controller.h @@ -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); } };