Skip to content

Commit

Permalink
src: use FromMaybe instead of ToLocal in GetCert
Browse files Browse the repository at this point in the history
PR-URL: #34276
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
danbev authored and addaleax committed Sep 22, 2020
1 parent 845411a commit 8624fd6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/node_crypto_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,8 @@ MaybeLocal<Value> GetCert(Environment* env, const SSLPointer& ssl) {
if (cert == nullptr)
return Undefined(env->isolate());

Local<Value> ret;
MaybeLocal<Object> maybe_cert = X509ToObject(env, cert);
return maybe_cert.ToLocal(&ret) ? ret : MaybeLocal<Value>();
return maybe_cert.FromMaybe<Value>(Local<Value>());
}

namespace {
Expand Down

0 comments on commit 8624fd6

Please sign in to comment.