diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 13721191c00..05999203036 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -75,6 +75,7 @@ Ref Mesh::generate_triangle_mesh() const { continue; Array a = surface_get_arrays(i); + ERR_FAIL_COND_V(a.empty(), Ref()); int vc = surface_get_array_len(i); PoolVector vertices = a[ARRAY_VERTEX]; @@ -234,6 +235,7 @@ Ref Mesh::create_convex_shape() const { for (int i = 0; i < get_surface_count(); i++) { Array a = surface_get_arrays(i); + ERR_FAIL_COND_V(a.empty(), Ref()); PoolVector v = a[ARRAY_VERTEX]; vertices.append_array(v); } @@ -273,6 +275,7 @@ Ref Mesh::create_outline(float p_margin) const { continue; Array a = surface_get_arrays(i); + ERR_FAIL_COND_V(a.empty(), Ref()); if (i == 0) { arrays = a; @@ -378,6 +381,7 @@ Ref Mesh::create_outline(float p_margin) const { PoolVector::Write r = vertices.write(); if (indices.size()) { + ERR_FAIL_COND_V(indices.size() % 3 != 0, Ref()); vc = indices.size(); ir = indices.write(); has_indices = true;