Skip to content

Commit 1b3c643

Browse files
committed
Be more conservative about checking zero values
1 parent b5f1ca2 commit 1b3c643

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/abstractsparsearrayinterface.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ end
9797
a::AbstractArray{<:Any,N}, value, I::Vararg{Int,N}
9898
) where {N}
9999
if !isstored(a, I...)
100-
iszero(value) && return a
100+
# Don't set the value if it is zero, but only check
101+
# if it is zero if the elements are numbers since otherwise
102+
# it may be nontrivial to check.
103+
eltype(a) <: Number && iszero(value) && return a
101104
setunstoredindex!(a, value, I...)
102105
return a
103106
end

0 commit comments

Comments
 (0)