-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Harden SignatureEquals nullability checks #53052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -108,8 +108,13 @@ public override int GetHashCode() => | |||||||||||||||
|
||||||||||||||||
public static bool SignatureEquals(Endpoint a, Endpoint b) | ||||||||||||||||
{ | ||||||||||||||||
if (a == null || b == null) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle both being null? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could do so by returning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
{ | ||||||||||||||||
return false; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if (!string.Equals(a.Response?.WrappedResponseType, b.Response?.WrappedResponseType, StringComparison.Ordinal) || | ||||||||||||||||
!a.HttpMethod.Equals(b.HttpMethod, StringComparison.Ordinal) || | ||||||||||||||||
!string.Equals(a.HttpMethod, b.HttpMethod, StringComparison.Ordinal) || | ||||||||||||||||
a.Parameters.Length != b.Parameters.Length) | ||||||||||||||||
{ | ||||||||||||||||
return false; | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the parameters be nullable?