Add safety check for at least 2 nodes and 1 link to GodotSoftBody3D.reoptimize_link_order() before proceeding. Fixes #61474

This commit is contained in:
Mark Riedesel 2022-10-31 09:13:47 -05:00
parent 0e9878b12a
commit 7d1a159ba1

View file

@ -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]);