From 8ea56a9606cdd0300488eaf7a9653dde6c1e3017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 15 Dec 2021 16:45:50 +0100 Subject: [PATCH] crypto: fix error capture when loading engine PR-URL: https://github.com/nodejs/node/pull/41187 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Filip Skokan Reviewed-By: Colin Ihrig Reviewed-By: Mohammed Keyvanzadeh --- src/crypto/crypto_util.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc index e1a6c41c91dccb..e93edd4b2fc952 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -607,9 +607,8 @@ EnginePointer LoadEngineById(const char* id, CryptoErrorStore* errors) { } if (!engine && errors != nullptr) { - if (ERR_get_error() != 0) { - errors->Capture(); - } else { + errors->Capture(); + if (errors->Empty()) { errors->Insert(NodeCryptoError::ENGINE_NOT_FOUND, id); } }