1
0
Fork 0

On shutdown, the renderer might already be gone.

Check for this when trying to remove the event handler.
This commit is contained in:
James Turner 2020-08-12 15:33:20 +01:00
parent 16ae171333
commit 5d2bb87601

View file

@ -275,7 +275,10 @@ PUICamera::~PUICamera()
{ {
SG_LOG(SG_GL, SG_INFO, "Deleting PUI camera"); SG_LOG(SG_GL, SG_INFO, "Deleting PUI camera");
auto viewer = globals->get_renderer()->getViewer(); // depending on if we're doing shutdown or reset, various things can be
// null here.
auto renderer = globals->get_renderer();
auto viewer = renderer ? renderer->getViewer() : nullptr;
if (viewer) { if (viewer) {
viewer->removeEventHandler(_eventHandler); viewer->removeEventHandler(_eventHandler);
} }