Skip to content

Commit 569a07e

Browse files
fallback in copyat_or_push! to pushing to i if not correctly sized
1 parent 55c1dca commit 569a07e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RecursiveArrayTools"
22
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "2.24.0"
4+
version = "2.24.1"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/utils.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ function copyat_or_push!(a::AbstractVector{T},i::Int,x,nc::Type{Val{perform_copy
7575
# or `b[i] = a[i]`, see https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19
7676
a[i] = x
7777
else
78-
recursivecopy!(a[i],x)
78+
if length(a[i]) == length(x)
79+
recursivecopy!(a[i],x)
80+
else
81+
a[i] = recursivecopy(x)
82+
end
7983
end
8084
else
8185
if perform_copy

0 commit comments

Comments
 (0)