Skip to content

Commit 2341d3c

Browse files
committed
fix: length of u may not be defined
1 parent 61470f6 commit 2341d3c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/ImplicitDiscreteSolve/src/solve.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function initialize!(integrator, cache::IDSolveCache)
2222
else
2323
(u_next, p) -> f(u_next, p.u, p.p, p.t_next)
2424
end
25-
nlls = !isnothing(f.resid_prototype) && (length(f.resid_prototype) != length(integrator.u))
25+
u_len = isnothing(integrator.u) ? 0 : length(integrator.u)
26+
nlls = !isnothing(f.resid_prototype) && (length(f.resid_prototype) != u_len)
2627

2728
prob = if nlls
2829
NonlinearLeastSquaresProblem{isinplace(f)}(NonlinearFunction(_f; resid_prototype = f.resid_prototype), cache.state.u, cache.state)

0 commit comments

Comments
 (0)