mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-08 13:01:52 +00:00
Narrow fillet_corner_p3 null-curve guard and check curve count first
The shim no longer refuses a corner edge without a 3D curve: upstream CreateCornerBlend returns SM_ERR below four curves and otherwise SM_ERR_NULL_POINTER, without crashing. create_corner_patch now checks the count before dereferencing curves, matching that order. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011gJAwcLRBPQXYLmvXd3pWf
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -587,8 +587,8 @@ double p3_check_default_patch(SmFilletCorner* c, const std::vector<SmFilletEdge*
|
||||
}
|
||||
}
|
||||
SmCurve* curve = fe == ov.edge ? ov.curve : fe->GetCurve();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user