summaryrefslogtreecommitdiff
path: root/servers/physics_3d
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2021-10-20 18:59:17 -0700
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2021-10-21 08:56:12 -0700
commite6f7235ffb49e94a876756a9295b907ce7fc834a (patch)
treea9440fe98642e894b0f045ba4f42acc1ebc781b8 /servers/physics_3d
parentfad7034e8b8275ce89424185c6ccee4de6aebd7f (diff)
Fix SoftDynamicBody3D crash when setting disable mode
Proper logic for changing physics state when disabled and disabled mode is changed (it was unnecessarily making calls to re-initialize physics). Extra error handling in soft body implementations to avoid crashes with invalid mesh.
Diffstat (limited to 'servers/physics_3d')
-rw-r--r--servers/physics_3d/godot_soft_body_3d.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/servers/physics_3d/godot_soft_body_3d.cpp b/servers/physics_3d/godot_soft_body_3d.cpp
index d15235d27c..f214e3603a 100644
--- a/servers/physics_3d/godot_soft_body_3d.cpp
+++ b/servers/physics_3d/godot_soft_body_3d.cpp
@@ -139,6 +139,7 @@ void GodotSoftBody3D::set_mesh(RID p_mesh) {
}
Array arrays = RenderingServer::get_singleton()->mesh_surface_get_arrays(soft_mesh, 0);
+ ERR_FAIL_COND(arrays.is_empty());
bool success = create_from_trimesh(arrays[RenderingServer::ARRAY_INDEX], arrays[RenderingServer::ARRAY_VERTEX]);
if (!success) {