diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-03-18 16:26:42 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-03-18 16:26:42 -0700 |
commit | 195eda244f5f259c45dc64818b1830ce323e4bf7 (patch) | |
tree | 6c6f99e5fc521ddb91f1aaeb8a076857954bfafa /scene/3d | |
parent | c097ce0c1843f71271b8af9a1291602b1aab7df6 (diff) |
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.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/soft_body_3d.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<Node3D>(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<Node3D>(get_node(r[i].spatial_attachment_path)); + } } if (!r[i].spatial_attachment) { |