From 611c435dabcf6ea96aac061d64c238f9cd9b0ef4 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Thu, 2 Nov 2023 02:19:13 +0100 Subject: [PATCH] Fix CSGShape debug_collision_shape crash Fixes CSGShape debug_collision_shape crash. (cherry picked from commit 0cba21f2da096d9cc183fecf720fb9f83a9f37ba) --- modules/csg/csg_shape.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 814f2184b02..f5d733ee6b9 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -488,7 +488,9 @@ bool CSGShape3D::_is_debug_collision_shape_visible() { } void CSGShape3D::_update_debug_collision_shape() { - // NOTE: This is called only for the root shape with collision, when root_collision_shape is valid. + if (!use_collision || !is_root_shape() || !root_collision_shape.is_valid() || !_is_debug_collision_shape_visible()) { + return; + } ERR_FAIL_NULL(RenderingServer::get_singleton());