Fixed crash on delete physical bone

This commit is contained in:
Andrea Catania 2018-11-01 09:46:46 +01:00
parent 13eaded911
commit 0a4ceb34d3
1 changed files with 4 additions and 2 deletions

View File

@ -2326,6 +2326,7 @@ void PhysicalBone::set_joint_type(JointType p_joint_type) {
if (p_joint_type == get_joint_type()) if (p_joint_type == get_joint_type())
return; return;
if (joint_data)
memdelete(joint_data); memdelete(joint_data);
joint_data = NULL; joint_data = NULL;
switch (p_joint_type) { switch (p_joint_type) {
@ -2526,6 +2527,7 @@ PhysicalBone::PhysicalBone() :
} }
PhysicalBone::~PhysicalBone() { PhysicalBone::~PhysicalBone() {
if (joint_data)
memdelete(joint_data); memdelete(joint_data);
} }