Fix #108817: Extrude node crash with vertex-only input

The `.edge_verts`attribute might not exist if there were no edges.
This commit is contained in:
Hans Goudey
2023-06-12 07:52:00 -04:00
parent d75aeb03e5
commit 18350ba06a

View File

@@ -129,6 +129,10 @@ static void expand_mesh(Mesh &mesh,
CustomData_realloc(&mesh.vdata, old_verts_num, mesh.totvert);
}
if (edge_expand != 0) {
if (mesh.totedge == 0) {
mesh.attributes_for_write().add(
".edge_verts", ATTR_DOMAIN_EDGE, CD_PROP_INT32_2D, bke::AttributeInitConstruct());
}
CustomData_free_layers(&mesh.edata, CD_BWEIGHT, mesh.totedge);
CustomData_free_layers(&mesh.edata, CD_FREESTYLE_EDGE, mesh.totedge);
const int old_edges_num = mesh.totedge;