diff --git a/csharp/extractor/Semmle.Extraction/LocationExtensions.cs b/csharp/extractor/Semmle.Extraction/LocationExtensions.cs index 9ea70c00a0e..f615fe65963 100644 --- a/csharp/extractor/Semmle.Extraction/LocationExtensions.cs +++ b/csharp/extractor/Semmle.Extraction/LocationExtensions.cs @@ -76,7 +76,7 @@ namespace Semmle.Extraction /// lexicographically smaller filepath and span is considered better. /// public static Location? BestOrDefault(this IEnumerable locations) => - locations.Any() ? locations.Aggregate((best, loc) => BetterThan(best, loc) ? best : loc) : null; + locations.Any() ? locations.Aggregate((best, loc) => BetterThan(loc, best) ? loc : best) : null; public static Location Best(this IEnumerable locations) => locations.BestOrDefault() ?? throw new ArgumentException("No location found.");