Fix: Line Art: Prevent loading empty meshes

In `lineart_geometry_check_visible` it could recieve a valid mesh
without any vertices, this causes `bounds` below to be invalid.
Now return early if encountered such situation.

Pull Request: https://projects.blender.org/blender/blender/pulls/136819
This commit is contained in:
YimingWu
2025-04-04 12:04:20 +02:00
committed by Falk David
parent 4710639619
commit b54d629401

View File

@@ -2430,9 +2430,12 @@ static bool lineart_geometry_check_visible(double model_view_proj[4][4],
if (!use_mesh) {
return false;
}
const Bounds<float3> bounds = *use_mesh->bounds_min_max();
const std::optional<Bounds<float3>> bounds = use_mesh->bounds_min_max();
if (!bounds.has_value()) {
return false;
}
BoundBox bb;
BKE_boundbox_init_from_minmax(&bb, bounds.min, bounds.max);
BKE_boundbox_init_from_minmax(&bb, bounds.value().min, bounds.value().max);
double co[8][4];
double tmp[3];