diff --git a/src/iteration.jl b/src/iteration.jl index f0f5a92f..55a5d9db 100644 --- a/src/iteration.jl +++ b/src/iteration.jl @@ -120,7 +120,7 @@ mutable struct LazyBranch{T,J,B} <: AbstractVector{T} if J != Nojagg # if branch is jagged, fix the buffer and eltype according to what # VectorOfVectors would return in `getindex` - _buffer = VectorOfVectors(T(), Int32[1]) + _buffer = isbitstype(T) ? VectorOfVectors(T[], Int32[1]) : VectorOfVectors(T(), Int32[1]) T = SubArray{eltype(T), 1, T, Tuple{UnitRange{Int64}}, true} end Nthreads = _maxthreadid() diff --git a/test/runtests.jl b/test/runtests.jl index 92a49271..195bcd81 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -728,6 +728,13 @@ end # issue 246 arr = LazyTree(joinpath(SAMPLES_DIR, "issue246.root"), "tree_NOMINAL").v_mcGenWgt @test all(reduce(vcat, arr) .== 1.0) + + # issue 323 + f = ROOTFile(joinpath(SAMPLES_DIR, "issue323.root")) + t = LazyTree(f, "sim", [r"ghost/ghost\.(.*)" => s"\1"]) + @test 1200 == length(t) + @test t[1].time[2] ≈ 36.396744f0 + @test t[end].xpos[end] ≈ 788.35144f0 end @testset "jagged subbranch type by leaf" begin diff --git a/test/samples/issue323.root b/test/samples/issue323.root new file mode 100644 index 00000000..47567e4e Binary files /dev/null and b/test/samples/issue323.root differ