From 94a4310c4a7711afb7b1f2ea48f0503fff5f03c9 Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <joseph@walton-rivers.uk> Date: Thu, 4 Aug 2022 11:47:27 +0100 Subject: [PATCH] fix segfault in bullet cleanup routine --- integrations/bullet/src/simulation.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/integrations/bullet/src/simulation.cpp b/integrations/bullet/src/simulation.cpp index 8985076..85a3803 100644 --- a/integrations/bullet/src/simulation.cpp +++ b/integrations/bullet/src/simulation.cpp @@ -195,7 +195,9 @@ namespace fggl::phys::bullet { auto entRB = m_ecs->find<BulletBody>(); for (const auto& ent : entRB) { auto& bulletBody = m_ecs->get<BulletBody>(ent); - m_world->removeCollisionObject(bulletBody.body); + if ( bulletBody.body != nullptr ) { + m_world->removeCollisionObject(bulletBody.body); + } // release resources and delete bulletBody.release(); -- GitLab