Prevent errors when drawing debug meshes when surface count is zero.

Adds a few checks to ensure a debug collision mesh contains mesh data before
attempting to add it to the gizmo draw list. This prevents errors when using
SeparationRayShape3D, which is only intended to draw a single line, and
contains no mesh data.

Closes #100665
This commit is contained in:
BattyBovine
2025-01-02 02:33:50 -05:00
parent 4cf02312f6
commit 6dc6ad2b86
2 changed files with 7 additions and 4 deletions
@@ -350,7 +350,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
if (cs->get_debug_fill_enabled()) {
Ref<ArrayMesh> array_mesh = s->get_debug_arraymesh_faces(collision_color);
if (array_mesh.is_valid()) {
if (array_mesh.is_valid() && array_mesh->get_surface_count() > 0) {
p_gizmo->add_mesh(array_mesh, material_arraymesh);
}
}