From 9b51d850562b457ad2211c0ab1dca19cb1361904 Mon Sep 17 00:00:00 2001 From: maelstrom Date: Thu, 23 Jan 2025 22:38:24 +0100 Subject: [PATCH] fix: double-free due to calling super-destructor --- src/objects/part.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objects/part.cpp b/src/objects/part.cpp index 54e99c2..92af98a 100644 --- a/src/objects/part.cpp +++ b/src/objects/part.cpp @@ -24,8 +24,8 @@ Part::Part(PartConstructParams params): Instance(&TYPE_), position(params.positi // This feels wrong. Get access to PhysicsWorld somehow else? Part will need access to this often though, most likely... extern rp::PhysicsWorld* world; Part::~Part() { - world->destroyRigidBody(rigidBody); - Instance::~Instance(); + if (this->rigidBody) + world->destroyRigidBody(rigidBody); }