From f284fda3a6903883861a31c175d399f4bcc558d5 Mon Sep 17 00:00:00 2001 From: nattthebear Date: Fri, 1 Jan 2021 17:06:59 -0500 Subject: [PATCH] Object.Equals(object) overrides should not throw Especially not if you pass null. null is simply not equal to this, that's all. The post condition is satisfiable; you can return false. --- src/BizHawk.Common/Bit.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Common/Bit.cs b/src/BizHawk.Common/Bit.cs index bd72ffe6b0..4f07234b04 100644 --- a/src/BizHawk.Common/Bit.cs +++ b/src/BizHawk.Common/Bit.cs @@ -83,7 +83,7 @@ namespace BizHawk.Common public override bool Equals(object? obj) { - return this == (Bit) (obj ?? throw new NullReferenceException()); // this is probably wrong + return obj is Bit b && this == b; } } -} \ No newline at end of file +}