From 05e665016c57072e9440532161fb3f581227053f Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 2 Mar 2021 16:46:50 -0500 Subject: [PATCH] check for NULL handle in `_fd` (#39879) In this case the object is in an invalid state, but it at least allows printing the object so you can see that. --- base/stream.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/stream.jl b/base/stream.jl index 81adf0c639623..509bc9953add6 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -1120,7 +1120,7 @@ _fd(x::Union{OS_HANDLE, RawFD}) = x function _fd(x::Union{LibuvStream, LibuvServer}) fd = Ref{OS_HANDLE}(INVALID_OS_HANDLE) - if x.status != StatusUninit && x.status != StatusClosed + if x.status != StatusUninit && x.status != StatusClosed && x.handle != C_NULL err = ccall(:uv_fileno, Int32, (Ptr{Cvoid}, Ptr{OS_HANDLE}), x.handle, fd) # handle errors by returning INVALID_OS_HANDLE end