diff --git a/openVulkanoCpp/Scene/Prefabs/ArBackgroundDrawable.cpp b/openVulkanoCpp/Scene/Prefabs/ArBackgroundDrawable.cpp index 6268abc..7772469 100644 --- a/openVulkanoCpp/Scene/Prefabs/ArBackgroundDrawable.cpp +++ b/openVulkanoCpp/Scene/Prefabs/ArBackgroundDrawable.cpp @@ -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; } -} \ No newline at end of file +}