summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-15 09:50:37 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-15 09:50:37 +0100
commit174925e55c7e264151c04bcc2ac3100671845bf0 (patch)
treef4b5394aed5742e89406c56667e888e7848165d6 /scene
parent204be35fc1fc4aa7325c0c5e6535e6667ff5a582 (diff)
parentd842d215df2e4a9d0ed6231232f6301d825da1d7 (diff)
Merge pull request #73262 from chutchinson/bug/73201-immediate-mesh-create-outline-crash
Prevent crash in ImmediateMesh.create_outline
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/mesh.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index cf9baa2907..a7b53244e2 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -526,6 +526,9 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
vc = indices.size();
ir = indices.ptrw();
has_indices = true;
+ } else {
+ // Ensure there are enough vertices to construct at least one triangle.
+ ERR_FAIL_COND_V(vertices.size() % 3 != 0, Ref<ArrayMesh>());
}
HashMap<Vector3, Vector3> normal_accum;