Skip to content

Commit 10d9947

Browse files
fix: handle empty syms in concrete_getu
1 parent dc36ba1 commit 10d9947

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/systems/problem_utils.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,19 @@ function get_mtkparameters_reconstructor(srcsys::AbstractSystem, dstsys::Abstrac
667667

668668
# `syms[1]` is always the tunables because `srcsys` will have initials.
669669
tunable_syms = syms[1]
670-
tunable_getter = p_constructor concrete_getu(srcsys, tunable_syms)
670+
tunable_getter = if isempty(tunable_syms)
671+
Returns(SizedVector{0, Float64})
672+
else
673+
p_constructor concrete_getu(srcsys, tunable_syms)
674+
end
671675
rest_getters = map(Base.tail(Base.tail(syms))) do buf
672676
if buf == ()
673677
return Returns(())
674678
else
675679
return Base.Fix1(broadcast, p_constructor) getu(srcsys, buf)
676680
end
677681
end
678-
initials_getter = if initials
682+
initials_getter = if initials && !isempty(syms[2])
679683
initsyms = syms[2]
680684
allsyms = Set(all_symbols(srcsys))
681685
if unwrap_initials

0 commit comments

Comments
 (0)