Skip to content

Commit

Permalink
move null check in unsafe_convert of RefValue
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 13, 2024
1 parent 2616634 commit 935d6a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/refvalue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function unsafe_convert(P::Union{Type{Ptr{T}},Type{Ptr{Cvoid}}}, b::RefValue{T})
# Instead, explicitly load the pointer from the `RefValue`,
# which also ensures this returns same pointer as the one rooted in the `RefValue` object.
p = atomic_pointerref(Ptr{Ptr{Cvoid}}(pointer_from_objref(b)), :monotonic)
end
if p == C_NULL
throw(UndefRefError())
if p == C_NULL
throw(UndefRefError())
end
end
return p
end
Expand Down

0 comments on commit 935d6a6

Please sign in to comment.