Skip to content
Snippets Groups Projects
Commit 803392e9 authored by murgatroid99's avatar murgatroid99
Browse files

Node server: add NULL check to tryShutdown

parent c22d62f5
No related branches found
No related tags found
No related merge requests found
......@@ -277,6 +277,12 @@ NAN_METHOD(Server::TryShutdown) {
return Nan::ThrowTypeError("tryShutdown can only be called on a Server");
}
Server *server = ObjectWrap::Unwrap<Server>(info.This());
if (server->wrapped_server == NULL) {
// Server is already shut down. Call callback immediately.
Nan::Callback callback(info[0].As<Function>());
callback.Call(0, {});
return;
}
TryShutdownOp *op = new TryShutdownOp(server, info.This());
unique_ptr<OpVec> ops(new OpVec());
ops->push_back(unique_ptr<Op>(op));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment