Skip to content

Commit 96bf961

Browse files
committed
refactor: avoid substitute warning when not needed
1 parent 421e41e commit 96bf961

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/systems/abstractsystem.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,8 +2600,10 @@ end
26002600

26012601
keytype(::Type{<:Pair{T, V}}) where {T, V} = T
26022602
function Symbolics.substitute(sys::AbstractSystem, rules::Union{Vector{<:Pair}, Dict})
2603-
if has_continuous_domain(sys) && get_continuous_events(sys) !== nothing ||
2604-
has_discrete_events(sys) && get_discrete_events(sys) !== nothing
2603+
if has_continuous_domain(sys) && get_continuous_events(sys) !== nothing &&
2604+
!isempty(get_continuous_events(sys)) ||
2605+
has_discrete_events(sys) && get_discrete_events(sys) !== nothing &&
2606+
!isempty(get_discrete_events(sys))
26052607
@warn "`substitute` only supports performing substitutions in equations. This system has events, which will not be updated."
26062608
end
26072609
if keytype(eltype(rules)) <: Symbol

0 commit comments

Comments
 (0)