Skip to content

Commit 01a43be

Browse files
feat: error in late_binding_update_u0_p if newu0 is of incorrect length
1 parent 216aa73 commit 01a43be

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/systems/nonlinear/initializesystem.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,9 @@ function SciMLBase.late_binding_update_u0_p(
669669
initials = DiffEqBase.promote_u0(initials, newu0, t0)
670670
newp = repack(initials)
671671
end
672+
if length(newu0) != length(unknowns(sys))
673+
throw(ArgumentError("Expected `newu0` to be of same length as unknowns ($(length(unknowns(sys)))). Got $(typeof(newu0)) of length $(length(newu0))"))
674+
end
672675
setp(sys, Initial.(unknowns(sys)))(newp, newu0)
673676
return newu0, newp
674677
end

0 commit comments

Comments
 (0)