Skip to content

Commit 42aca13

Browse files
jasnelldanielleadams
authored andcommitted
crypto: fixup bug in keygen error handling
Signed-off-by: James M Snell <[email protected]> PR-URL: #36779 Refs: #36729 Reviewed-By: Tobias Nießen <[email protected]>
1 parent 4c819d6 commit 42aca13

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎lib/internal/crypto/keygen.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ function generateKeyPairSync(type, options){
9494
}
9595

9696
functionhandleError(ret){
97-
if(ret===undefined)
97+
if(ret==null)
9898
return;// async
9999

100-
const[err,[publicKey,privateKey]]=ret;
100+
const[err,keys]=ret;
101101
if(err!==undefined)
102102
throwerr;
103103

104+
const[publicKey,privateKey]=keys;
105+
104106
// If no encoding was chosen, return key objects instead.
105107
return{
106108
publicKey: wrapKey(publicKey,PublicKeyObject),

0 commit comments

Comments
(0)