|
245 | 245 | function (sol::AbstractODESolution)(t::Number, ::Type{deriv},
|
246 | 246 | idxs::AbstractVector{<:Integer},
|
247 | 247 | continuity) where {deriv}
|
| 248 | + if isempty(idxs) |
| 249 | + return eltype(eltype(sol.u))[] |
| 250 | + end |
248 | 251 | if eltype(sol.u) <: Number
|
249 | 252 | idxs = only(idxs)
|
250 | 253 | end
|
|
259 | 262 | function (sol::AbstractODESolution)(t::AbstractVector{<:Number}, ::Type{deriv},
|
260 | 263 | idxs::AbstractVector{<:Integer},
|
261 | 264 | continuity) where {deriv}
|
| 265 | + if isempty(idxs) |
| 266 | + return map(_ -> eltype(eltype(sol.u))[], t) |
| 267 | + end |
262 | 268 | if eltype(sol.u) <: Number
|
263 | 269 | idxs = only(idxs)
|
264 | 270 | end
|
@@ -295,6 +301,9 @@ function (sol::AbstractODESolution)(t::Number, ::Type{deriv}, idxs::AbstractVect
|
295 | 301 | any(isequal(NotSymbolic()), symbolic_type.(idxs))
|
296 | 302 | error("Incorrect specification of `idxs`")
|
297 | 303 | end
|
| 304 | + if isempty(idxs) |
| 305 | + return eltype(eltype(sol.u))[] |
| 306 | + end |
298 | 307 | error_if_observed_derivative(sol, idxs, deriv)
|
299 | 308 | ps = parameter_values(sol)
|
300 | 309 | if is_parameter_timeseries(sol) == Timeseries() && is_discrete_expression(sol, idxs)
|
|
335 | 344 |
|
336 | 345 | function (sol::AbstractODESolution)(t::AbstractVector{<:Number}, ::Type{deriv},
|
337 | 346 | idxs::AbstractVector, continuity) where {deriv}
|
| 347 | + if isempty(idxs) |
| 348 | + return map(_ -> eltype(eltype(sol.u))[], t) |
| 349 | + end |
338 | 350 | error_if_observed_derivative(sol, idxs, deriv)
|
339 | 351 | p = hasproperty(sol.prob, :p) ? sol.prob.p : nothing
|
340 | 352 | getter = getu(sol, idxs)
|
|
0 commit comments