From a40989faea6e1c1757cb6105717a435f35e0e2eb 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 57288e2c67e5af..e1ef170a9f1763 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -597,9 +597,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); } }