Skip to content

Commit 18855ab

Browse files
chore: copy MTKparameter fields only if not empty
1 parent 7f90698 commit 18855ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/systems/parameter_buffer.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ function Base.copy(p::MTKParameters)
319319
initials = copy(p.initials)
320320
discrete = Tuple(eltype(buf) <: Real ? copy(buf) : copy.(buf) for buf in p.discrete)
321321
constant = Tuple(eltype(buf) <: Real ? copy(buf) : copy.(buf) for buf in p.constant)
322-
nonnumeric = copy.(p.nonnumeric)
323-
caches = copy.(p.caches)
322+
nonnumeric = isempty(p.nonnumeric) ? p.nonnumeric : copy.(p.nonnumeric)
323+
caches = isempty(p.caches) ? p.caches : copy.(p.caches)
324324
return MTKParameters(
325325
tunable,
326326
initials,

0 commit comments

Comments
 (0)