浏览代码

Fix TimestampPartial operator == overload implementation: Cannot call == inside it, otherwise it would cause stack overflow

Hao Nguyen 6 年之前
父节点
当前提交
3d207c33a4
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs

+ 1 - 1
csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs

@@ -308,7 +308,7 @@ namespace Google.Protobuf.WellKnownTypes
         /// <returns>true if the two timestamps refer to the same nanosecond</returns>
         public static bool operator ==(Timestamp a, Timestamp b)
         {
-            return ReferenceEquals(a, b) || (a == null ? (b == null ? true : false) : a.Equals(b));
+            return ReferenceEquals(a, b) || (ReferenceEquals(a, null) ? (ReferenceEquals(b, null) ? true : false) : a.Equals(b));
         }
 
         /// <summary>