diff --git a/crates/solidcore/src/blend/fillet_corner/p3.rs b/crates/solidcore/src/blend/fillet_corner/p3.rs index 3c39331c1d..ebc51cf2e3 100644 --- a/crates/solidcore/src/blend/fillet_corner/p3.rs +++ b/crates/solidcore/src/blend/fillet_corner/p3.rs @@ -1479,6 +1479,13 @@ impl FilletCorner { let _ = total_edges; // build the corner patch from the ordered array boundary information + // CreateCornerBlend checks `cr3DCurves.GetSize() < 4 -> SM_ERR` before it + // touches any curve (a null one is SM_ERR_NULL_POINTER afterwards). + if ordered_3d.len() < 4 { + return Err(SolidError::sm_err( + "nurbs::b_spline_surface_n_lib::p2::BSplineSurface::create_corner_blend", + )); + } let mut curves_3d = Vec::with_capacity(ordered_3d.len()); for c in &ordered_3d { let c = c diff --git a/harness/cpp/shim/blend_fillet_corner_p3_static.inc b/harness/cpp/shim/blend_fillet_corner_p3_static.inc index 0d3cb58a42..423d43eb1d 100644 --- a/harness/cpp/shim/blend_fillet_corner_p3_static.inc +++ b/harness/cpp/shim/blend_fillet_corner_p3_static.inc @@ -587,8 +587,8 @@ double p3_check_default_patch(SmFilletCorner* c, const std::vectorGetCurve(); - if (curve == NULL) - return P3C_REFUSE; // CreateCornerBlend reads every boundary curve + // A NULL curve is not refused: CreateCornerBlend returns SM_ERR below four curves, + // else sm_CreateNonRationalCurve casts null-safely and returns SM_ERR_NULL_POINTER. uv.Add(ps); c3d.Add(curve); orients.Add(SM_OT_SAME);