Fix crash when using ArBackgroundDrawable without setting an ar session

This commit is contained in:
Georg Hagen
2024-07-17 16:15:42 +02:00
parent 41d4e98a0f
commit 1bb9c33699

View File

@@ -46,7 +46,8 @@ namespace OpenVulkano::Scene
void ArBackgroundDrawable::Close()
{
m_arSession->OnNewFrame -= EventHandler(this, &ArBackgroundDrawable::OnNewArFrame);
if (m_arSession) m_arSession->OnNewFrame -= EventHandler(this, &ArBackgroundDrawable::OnNewArFrame);
m_arSession = nullptr;
m_nextFrame = nullptr;
Drawable::Close();
}
@@ -70,4 +71,4 @@ namespace OpenVulkano::Scene
}
if (!m_texture) m_texture = &Texture::PLACEHOLDER;
}
}
}