src: fix nullptr dereference for signal during startup

This fixes a test failure when running
`test/parallel/test-child-process-spawnsync-kill-signal.js`
under load. What would happen is that `SignalExit()` tries
to shutdown the tracing agent, which might not have been set
up by the point that Node.js receives the signal.

PR-URL: https://github.com/nodejs/node/pull/20637
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Anna Henningsen 2018-05-09 19:52:53 +02:00
parent 5a0e379250
commit 5e6ca894cf
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -327,7 +327,8 @@ static struct {
}
void StopTracingAgent() {
tracing_agent_->Stop();
if (tracing_agent_)
tracing_agent_->Stop();
}
tracing::Agent* GetTracingAgent() const {