Re add fix sequence empty exception on calling max in program plugin (#6054)

This commit is contained in:
Divyansh Srivastava 2020-08-19 16:16:45 -07:00 committed by GitHub
parent 2a7bf7fb5b
commit 69cb20e1cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,8 +87,11 @@ namespace Microsoft.Plugin.Program
.Select(p => p.Result(query.Search, _context.API));
var result = results1.Concat(results2).Where(r => r != null && r.Score > 0);
var maxScore = result.Max(x => x.Score);
result = result.Where(x => x.Score > Settings.MinScoreThreshold * maxScore);
if (result.Any())
{
var maxScore = result.Max(x => x.Score);
result = result.Where(x => x.Score > Settings.MinScoreThreshold * maxScore);
}
return result.ToList();
}