Fix #132449: Crash converting empty curves to mesh

Caused by b3a06149bb.

`curve_to_mesh` returns null for empty meshes.
This fix guards access to the result with a null check.

Pull Request: https://projects.blender.org/blender/blender/pulls/132453
This commit is contained in:
YimingWu
2025-01-01 20:21:30 +01:00
committed by Hans Goudey
parent 25febbbb32
commit d53d7a42df

View File

@@ -115,8 +115,10 @@ static void node_geo_exec(GeoNodeExecParams params)
if (geometry_set.has_curves()) {
const Curves &curves = *geometry_set.get_curves();
Mesh *mesh = curve_to_mesh(curves.geometry.wrap(), profile_set, fill_caps, attribute_filter);
mesh->mat = static_cast<Material **>(MEM_dupallocN(curves.mat));
mesh->totcol = curves.totcol;
if (mesh != nullptr) {
mesh->mat = static_cast<Material **>(MEM_dupallocN(curves.mat));
mesh->totcol = curves.totcol;
}
geometry_set.replace_mesh(mesh);
}
if (geometry_set.has_grease_pencil()) {