Fix: unhandled empty Optional in 'bounds_min_max()'

Continuation of fcfce8f69f
This commit is contained in:
Germano Cavalcante
2024-03-28 10:59:49 -03:00
parent 90c53d265b
commit 5bdfec8d67

View File

@@ -106,12 +106,13 @@ static bool raycastMesh(SnapObjectContext *sctx,
}
/* Test bounding box. */
const Bounds<float3> bounds = *mesh_eval->bounds_min_max();
/* Was #BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
if (!isect_ray_aabb_v3_simple(
ray_start_local, ray_normal_local, bounds.min, bounds.max, &len_diff, nullptr))
{
return retval;
if (std::optional<Bounds<float3>> bounds = mesh_eval->bounds_min_max()) {
/* Was #BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
if (!isect_ray_aabb_v3_simple(
ray_start_local, ray_normal_local, bounds->min, bounds->max, &len_diff, nullptr))
{
return retval;
}
}
/* We pass a temp ray_start, set from object's boundbox, to avoid precision issues with