Skip to content

Commit 339a0ba

Browse files
committed
Fix is_good_array for empty input
1 parent 9177e69 commit 339a0ba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Utils.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ end
7777
# Thanks @mikmore https://discourse.julialang.org/t/fastest-way-to-check-for-inf-or-nan-in-an-array/76954/33?u=milescranmer
7878
is_bad_array(x) = !is_good_array(x)
7979
function is_good_array(x)
80-
IS_WINDOWS && return sum(xi -> xi * zero(xi), x) == zero(eltype(x))
81-
return isempty(x) || vmapreduce(xi -> xi * zero(xi), +, x) == zero(eltype(x))
80+
isempty(x) && return true
81+
IS_WINDOWS && return sum(xi -> xi * zero(xi), x) == 0
82+
return vmapreduce(xi -> xi * zero(xi), +, x) == 0
8283
end
8384
const IS_WINDOWS = Sys.iswindows()
8485

0 commit comments

Comments
 (0)