فهرست منبع

Prevent crash in ImmediateMesh.create_outline by ensuring
that when no indices are specified, the number of vertices is
at least a factor of 3. Fixes #73201

Chris Hutchinson 2 سال پیش
والد
کامیت
d842d215df
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      scene/resources/mesh.cpp

+ 3 - 0
scene/resources/mesh.cpp

@@ -526,6 +526,9 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
 			vc = indices.size();
 			vc = indices.size();
 			ir = indices.ptrw();
 			ir = indices.ptrw();
 			has_indices = true;
 			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;
 		HashMap<Vector3, Vector3> normal_accum;