diff options
author | Mark Riedesel <mark@klowner.com> | 2022-10-31 09:13:47 -0500 |
---|---|---|
committer | Mark Riedesel <mark@klowner.com> | 2022-10-31 10:14:02 -0500 |
commit | 7d1a159ba1d799875a9b886f1689724c897057d5 (patch) | |
tree | 4f16c87e02a07392cd57022fa78633bd733a5a21 /servers/physics_3d/godot_soft_body_3d.cpp | |
parent | 0e9878b12a1e91d0f9ce2c1b56d1d469dd1758f6 (diff) |
Add safety check for at least 2 nodes and 1 link to GodotSoftBody3D.reoptimize_link_order() before proceeding. Fixes #61474
Diffstat (limited to 'servers/physics_3d/godot_soft_body_3d.cpp')
-rw-r--r-- | servers/physics_3d/godot_soft_body_3d.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/servers/physics_3d/godot_soft_body_3d.cpp b/servers/physics_3d/godot_soft_body_3d.cpp index 173843072a..77110c5fbc 100644 --- a/servers/physics_3d/godot_soft_body_3d.cpp +++ b/servers/physics_3d/godot_soft_body_3d.cpp @@ -722,7 +722,14 @@ void GodotSoftBody3D::reoptimize_link_order() { const int reop_not_dependent = -1; const int reop_node_complete = -2; - uint32_t i, link_count = links.size(), node_count = nodes.size(); + uint32_t link_count = links.size(); + uint32_t node_count = nodes.size(); + + if (link_count < 1 || node_count < 2) { + return; + } + + uint32_t i; Link *lr; int ar, br; Node *node0 = &(nodes[0]); |