diff --git a/src/array.jl b/src/array.jl index 8ed059e6..cef1e381 100644 --- a/src/array.jl +++ b/src/array.jl @@ -812,7 +812,7 @@ function _uniquerefs(A::CatArrOrSub{T}) where T res = similar(arefs, 0) nlevels = length(levels(A)) maxunique = nlevels + (T >: Missing ? 1 : 0) - seen = fill(false, maxunique) + seen = fill(false, nlevels + 1) # always +1 for 0 (missing ref) @inbounds for ref in arefs if !seen[ref + 1] push!(res, ref)