Skip to content

Commit

Permalink
- adds defensive statement for reference comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Oct 11, 2023
1 parent a6a3683 commit 5873c09
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public bool Equals(OpenApiSchema? x, OpenApiSchema? y)
(null, null) => true,
(null, _) => false,
(_, null) => false,
_ when x.Reference is not null && y.Reference is not null => x.Reference.Id.Equals(y.Reference.Id, StringComparison.OrdinalIgnoreCase),
_ when x.Reference is not null && !string.IsNullOrEmpty(x.Reference.Id) && y.Reference is not null && !string.IsNullOrEmpty(y.Reference.Id) =>
x.Reference.Id.Equals(y.Reference.Id, StringComparison.OrdinalIgnoreCase),
_ => x == y,
};
}
Expand Down

0 comments on commit 5873c09

Please sign in to comment.