diff --git a/src/Lucene.Net/Support/Threading/AtomicDouble.cs b/src/Lucene.Net/Support/Threading/AtomicDouble.cs index 62225e7ab9..20e5f1aa4b 100644 --- a/src/Lucene.Net/Support/Threading/AtomicDouble.cs +++ b/src/Lucene.Net/Support/Threading/AtomicDouble.cs @@ -364,7 +364,7 @@ public static implicit operator double(AtomicDouble atomicInt64) if (a2 is null) return false; - return a1.Equals(a2.Value); + return a2.Equals(a1); } /// @@ -411,10 +411,12 @@ public static implicit operator double(AtomicDouble atomicInt64) /// true if the given numbers are equal; otherwise, false. public static bool operator ==(double? a1, AtomicDouble? a2) { - if (!a1.HasValue) + if (a1 is null) return a2 is null; + if (a2 is null) + return false; - return a1.GetValueOrDefault().Equals(a2.Value); + return a2.Equals(a1.Value); } ///