From 195eda244f5f259c45dc64818b1830ce323e4bf7 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 18 Mar 2021 16:26:42 -0700 Subject: 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_3d.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index 2d8f22ab37..b732f81e4e 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -768,7 +768,9 @@ void SoftBody3D::_reset_points_offsets() { PinnedPoint *w = pinned_points.ptrw(); 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_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) { -- cgit v1.2.3