Skip to content

Commit 6dd1014

Browse files
committed
Check dict
1 parent f3083dd commit 6dd1014

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,11 @@ function tearing_reassemble(state::TearingState, var_eq_matching; simplify = fal
559559
idx in removed_obs_set && continue
560560
# Because it's a differential variable, and by sorting, its
561561
# corresponding differential equation would have the same index.
562-
eqidx = diff_to_var[var_to_idx[dx]]
562+
dxidx = get(var_to_idx, dx, nothing)
563+
# TODO: use alias graph to handle the dxidx === nothing case for
564+
# mechanical systems.
565+
dxidx === nothing && continue
566+
eqidx = diff_to_var[dxidx]
563567
oldobs[idx] = (lhs ~ neweqs[eqidx].rhs)
564568
end
565569
deleteat!(oldobs, sort!(removed_obs))

0 commit comments

Comments
 (0)