From 569a07e9f0ecaacef167ee52e8101122a25c9b4a Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Mon, 24 Jan 2022 09:08:46 -0500 Subject: [PATCH] fallback in copyat_or_push! to pushing to i if not correctly sized --- Project.toml | 2 +- src/utils.jl | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 2e07d0d2..8c2067af 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RecursiveArrayTools" uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" authors = ["Chris Rackauckas "] -version = "2.24.0" +version = "2.24.1" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/utils.jl b/src/utils.jl index a47577be..131c01a6 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -75,7 +75,11 @@ function copyat_or_push!(a::AbstractVector{T},i::Int,x,nc::Type{Val{perform_copy # or `b[i] = a[i]`, see https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19 a[i] = x else - recursivecopy!(a[i],x) + if length(a[i]) == length(x) + recursivecopy!(a[i],x) + else + a[i] = recursivecopy(x) + end end else if perform_copy