fix(assembly): prevent segfault when all joints are removed #310

Merged
forbes merged 1 commits from fix/assembly-empty-joints-segfault into main 2026-02-21 15:48:02 +00:00

View File

@@ -275,8 +275,14 @@ void AssemblyObject::updateSolveStatus()
//+1 because there's a grounded joint to origin
lastDoF = (1 + numberOfComponents()) * 6;
if (!solver_ || lastResult_.placements.empty()) {
// Guard against re-entrancy: solve() calls updateSolveStatus(), so if
// placements are legitimately empty (e.g. zero constraints / all parts
// grounded) the recursive solve() would never terminate.
static bool updating = false;
if (!updating && (!solver_ || lastResult_.placements.empty())) {
updating = true;
solve();
updating = false;
}
if (!solver_) {