mirror of
https://github.com/Jackett/Jackett
synced 2025-02-24 23:22:46 +00:00
Bugfix/1471 aggregate exception when fallback (#1504)
* Line endings... * Fixes an issue when the aggregate doesn't require fallback Apparently operating on null with LINQ is not safe :) - This fixes Jackett/Jackett#1471
This commit is contained in:
parent
3f2d6f0cee
commit
cf9d87a7d8
1 changed files with 12 additions and 9 deletions
|
@ -77,15 +77,18 @@ namespace Jackett.Indexers.Meta
|
||||||
logger.Error(aggregateTask.Exception, "Error during request in metaindexer " + ID);
|
logger.Error(aggregateTask.Exception, "Error during request in metaindexer " + ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
var unorderedResult = tasks.Where(x => x.Status == TaskStatus.RanToCompletion).SelectMany(x => x.Result);
|
var unorderedResult = tasks.Where(x => x.Status == TaskStatus.RanToCompletion).SelectMany(x => x.Result);;
|
||||||
var orderedResult = unorderedResult.Where(r => {
|
if (needFallback) {
|
||||||
var normalizedTitles = fallbackTitles.Concat(fallbackTitles.Select(t => t.Replace(' ', '.').Replace(":", ""))).Select(t => t.ToLowerInvariant());
|
unorderedResult = unorderedResult.Where (r => {
|
||||||
|
var normalizedTitles = fallbackTitles.Concat (fallbackTitles.Select (t => t.Replace (' ', '.').Replace (":", ""))).Select (t => t.ToLowerInvariant ());
|
||||||
foreach (var title in normalizedTitles) {
|
foreach (var title in normalizedTitles) {
|
||||||
if (r.Title.ToLowerInvariant().Contains(title))
|
if (r.Title.ToLowerInvariant ().Contains (title))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}).OrderByDescending(r => r.Gain);
|
});
|
||||||
|
}
|
||||||
|
var orderedResult = unorderedResult.OrderByDescending(r => r.Gain);
|
||||||
|
|
||||||
var filteredResult = orderedResult.Where(r => {
|
var filteredResult = orderedResult.Where(r => {
|
||||||
if (r.Imdb != null) {
|
if (r.Imdb != null) {
|
||||||
|
|
Loading…
Reference in a new issue