Skip to content

Commit 07f3ede

Browse files
committed
Handle edge cases
1 parent 21408fd commit 07f3ede

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/vector_of_array.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ recursivecopy(VA::VectorOfArray) = VectorOfArray(copy.(VA.u))
9494
# For DiffEqArray it ignores ts and fills only u
9595
function Base.fill!(VA::AbstractVectorOfArray, x)
9696
for i in eachindex(VA)
97-
fill!(VA[i], x)
97+
if VA[i] isa AbstractArray
98+
fill!(VA[i], x)
99+
else
100+
VA[i] = x
101+
end
98102
end
99103
return VA
100104
end
@@ -171,7 +175,11 @@ end
171175
bc = Broadcast.flatten(bc)
172176
N = narrays(bc)
173177
@inbounds for i in 1:N
174-
copyto!(dest[i], unpack_voa(bc, i))
178+
if dest[i] isa AbstractArray
179+
copyto!(dest[i], unpack_voa(bc, i))
180+
else
181+
dest[i] = copy(unpack_voa(bc, i))
182+
end
175183
end
176184
dest
177185
end

0 commit comments

Comments
 (0)