From b3480a29cca5120ca386fae3586c4165cc50ae4f Mon Sep 17 00:00:00 2001 From: Jozef Gajdos Date: Fri, 17 Feb 2023 10:11:11 +0100 Subject: Update return values. --- crypto/src/x509/X509Certificate.cs | 6 ++---- crypto/src/x509/X509Crl.cs | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index aec793731..f58477439 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -477,8 +477,7 @@ namespace Org.BouncyCastle.X509 AsymmetricKeyParameter temp = PublicKeyFactory.CreateKey(c.SubjectPublicKeyInfo); - Interlocked.CompareExchange(ref publicKeyValue, temp, null); - return publicKeyValue; + return Interlocked.CompareExchange(ref publicKeyValue, temp, null) ?? temp; } /// @@ -699,8 +698,7 @@ namespace Org.BouncyCastle.X509 CachedEncoding temp = new CachedEncoding(encoding, exception); - Interlocked.CompareExchange(ref cachedEncoding, temp, null); - return cachedEncoding; + return Interlocked.CompareExchange(ref cachedEncoding, temp, null) ?? temp; } private static bool IsAlgIDEqual(AlgorithmIdentifier id1, AlgorithmIdentifier id2) diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs index e47addd7a..b4af1b374 100644 --- a/crypto/src/x509/X509Crl.cs +++ b/crypto/src/x509/X509Crl.cs @@ -466,8 +466,7 @@ namespace Org.BouncyCastle.X509 CachedEncoding temp = new CachedEncoding(encoding, exception); - Interlocked.CompareExchange(ref cachedEncoding, temp, null); - return cachedEncoding; + return Interlocked.CompareExchange(ref cachedEncoding, temp, null) ?? temp; } } } -- cgit 1.4.1