소스 검색

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.
PouleyKetchoupp 4 년 전
부모
커밋
195eda244f
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      scene/3d/soft_body_3d.cpp

+ 3 - 1
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) {