From 0ba600f71f0d88964fa7a5f160c0d1881c0878ca Mon Sep 17 00:00:00 2001 From: rishichawda Date: Tue, 7 Sep 2021 16:11:34 +0530 Subject: [PATCH] don't raise error in get if certificate is empty Signed-off-by: rishichawda --- lib/win32/certstore/store_base.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/win32/certstore/store_base.rb b/lib/win32/certstore/store_base.rb index 0156a32..4cc23c5 100644 --- a/lib/win32/certstore/store_base.rb +++ b/lib/win32/certstore/store_base.rb @@ -92,13 +92,8 @@ def cert_get(certificate_thumbprint, store_name:, store_location:) thumbprint = update_thumbprint(certificate_thumbprint) cert_pem = get_cert_pem(thumbprint, store_name: store_name, store_location: store_location) cert_pem = format_pem(cert_pem) - if cert_pem.empty? - raise ArgumentError, "Unable to retrieve the certificate" - end - unless cert_pem.empty? - build_openssl_obj(cert_pem) - end + cert_pem.empty? ? cert_pem : build_openssl_obj(cert_pem) end # Listing certificate of open certstore and return list in json