diff --git a/src/solutions/ode_solutions.jl b/src/solutions/ode_solutions.jl index e15a9e16f..c30e0a6d2 100644 --- a/src/solutions/ode_solutions.jl +++ b/src/solutions/ode_solutions.jl @@ -671,7 +671,7 @@ function Base.showerror(io::IO, e::LazyInterpolationException) end function strip_solution(sol::ODESolution; strip_alg = false) - if has_lazy_interpolation(sol.alg) + if sol.alg !== nothing && has_lazy_interpolation(sol.alg) throw(LazyInterpolationException(nameof(typeof(sol.alg)))) end diff --git a/test/downstream/ode_stripping.jl b/test/downstream/ode_stripping.jl index a33d91d92..b03db889e 100644 --- a/test/downstream/ode_stripping.jl +++ b/test/downstream/ode_stripping.jl @@ -21,3 +21,12 @@ stripped_sol = SciMLBase.strip_solution(sol) @test isnothing(stripped_sol.interp.cache.jac_config) @test isnothing(stripped_sol.interp.cache.grad_config) + +@testset "`nothing` alg with empty ODE" begin + prob = ODEProblem(Returns(nothing), nothing, (0.0, 1.0), nothing) + sol = solve(prob, Tsit5()) + @test sol.alg === nothing + stripped_sol = SciMLBase.strip_solution(sol) + @test stripped_sol.alg === nothing + @test stripped_sol.prob == (; p = nothing) +end