From e6f7235ffb49e94a876756a9295b907ce7fc834a Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 20 Oct 2021 18:59:17 -0700 Subject: 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. --- modules/bullet/soft_body_bullet.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/bullet') diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 81b832fb42..3a2370ff31 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -116,6 +116,7 @@ void SoftBodyBullet::set_soft_mesh(RID p_mesh) { } Array arrays = RenderingServer::get_singleton()->mesh_surface_get_arrays(soft_mesh, 0); + ERR_FAIL_COND(arrays.is_empty()); bool success = set_trimesh_body_shape(arrays[RS::ARRAY_INDEX], arrays[RS::ARRAY_VERTEX]); if (!success) { -- cgit v1.2.3