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.
This commit is contained in:
nattthebear 2021-01-01 17:06:59 -05:00
parent 51b62629c6
commit f284fda3a6
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}
}
}
}