summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2021-03-18 16:26:42 -0700
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2021-03-18 16:26:42 -0700
commit195eda244f5f259c45dc64818b1830ce323e4bf7 (patch)
tree6c6f99e5fc521ddb91f1aaeb8a076857954bfafa
parentc097ce0c1843f71271b8af9a1291602b1aab7df6 (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.
-rw-r--r--scene/3d/soft_body_3d.cpp4
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) {