diff options
Diffstat (limited to 'crypto/src/asn1/Asn1Set.cs')
-rw-r--r-- | crypto/src/asn1/Asn1Set.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs index 6ba0bb413..de3d10380 100644 --- a/crypto/src/asn1/Asn1Set.cs +++ b/crypto/src/asn1/Asn1Set.cs @@ -81,14 +81,13 @@ namespace Org.BouncyCastle.Asn1 if (element == null) throw new ArgumentNullException(nameof(element)); - if (element is Asn1Set asn1Set) - return asn1Set; + if (element is Asn1Set existing) + return existing; - if (element is IAsn1Convertible asn1Convertible && !(element is Asn1Object)) + if (element is IAsn1Convertible asn1Convertible && !(element is Asn1Object) && + asn1Convertible.ToAsn1Object() is Asn1Set converted) { - Asn1Object asn1Object = asn1Convertible.ToAsn1Object(); - if (asn1Object is Asn1Set converted) - return converted; + return converted; } return null; |