From 0b51cb7a11908302c48189bf79ef64435b0cf4e5 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 18 Mar 2021 16:22:53 -0700 Subject: [PATCH] Fix spamming errors when SoftBody pinned nodes have no attachment There was a specific case where the node path wasn't checked for validity before trying to access the attachment node. It could cause lots of error log noise in both editor and game. --- scene/3d/soft_body.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index bf3d6437ed81..3cb94e01ff9b 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -785,8 +785,11 @@ void SoftBody::_reset_points_offsets() { PoolVector::Write w = pinned_points.write(); for (int i = pinned_points.size() - 1; 0 <= i; --i) { - if (!r[i].spatial_attachment) - w[i].spatial_attachment = Object::cast_to(get_node(r[i].spatial_attachment_path)); + if (!r[i].spatial_attachment) { + if (!r[i].spatial_attachment_path.is_empty() && has_node(r[i].spatial_attachment_path)) { + w[i].spatial_attachment = Object::cast_to(get_node(r[i].spatial_attachment_path)); + } + } if (!r[i].spatial_attachment) continue;