fix(assembly): prevent segfault when all joints are removed #310
Reference in New Issue
Block a user
Delete Branch "fix/assembly-empty-joints-segfault"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Removing all joints from an assembly causes a segmentation fault (stack overflow).
Root Cause
updateSolveStatus()callssolve()whenlastResult_.placementsis empty, butsolve()callsupdateSolveStatus()at the end. When an assembly has zero constraints (all joints removed), the solver returns zero placements, solastResult_.placements.empty()remains true on every call — causing infinite recursion until stack overflow.Fix
Add a static re-entrancy guard to
updateSolveStatus()so the recursivesolve()call is skipped when already on the call stack.Testing