From 1bb9c33699ff6d929348a18ab116b8b582513f9e Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Wed, 17 Jul 2024 16:15:42 +0200 Subject: [PATCH] Fix crash when using ArBackgroundDrawable without setting an ar session --- openVulkanoCpp/Scene/Prefabs/ArBackgroundDrawable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 +}