diff --git a/modules/bullet/bullet_utilities.h b/modules/bullet/bullet_utilities.h index 029eb6691ae..553c1d03849 100644 --- a/modules/bullet/bullet_utilities.h +++ b/modules/bullet/bullet_utilities.h @@ -39,7 +39,8 @@ new cl #define bulletdelete(cl) \ - delete cl; \ - cl = NULL; - + { \ + delete cl; \ + cl = NULL; \ + } #endif diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index a3944b4f99a..402a276f958 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -310,9 +310,10 @@ void RigidCollisionObjectBullet::shape_changed(int p_shape_index) { void RigidCollisionObjectBullet::reload_shapes() { - if (mainShape && mainShape->isCompound()) + if (mainShape && mainShape->isCompound()) { // Destroy compound bulletdelete(mainShape); + } mainShape = NULL;