Unverified Commit c1da4e4a authored by Anna Henningsen's avatar Anna Henningsen
Browse files

src: fix inspecting `MessagePort` from `init` async hook

During the `init()` async hook, the C++ object is not finished
creating yet (i.e. it is an `AsyncWrap`, but not yet a `HandleWrap`
or `MessagePort`). Accessing the `handle_` field is not valid
in that case.

However, the custom inspect function for `MessagePort`s calls
`HasRef()` on the object, which would crash when the object
is not fully constructed. Fix that by guarding the access of
the libuv handle on that condition.

PR-URL: https://github.com/nodejs/node/pull/31600


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
Reviewed-By: default avatarLuigi Pinca <luigipinca@gmail.com>
parent 234de6f1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment