src: fix async hooks crashing when there is no node context
This commits basically skips any promise env hooks when there's no node context currently active, which would otherwise end up in a crash.
Fixes: https://github.com/nodejs/node/issues/19104
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
src (async_hooks)