1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-02-26 15:52:42 +00:00

Fixed: Possible DivideByZeroException when getting queue

Closes #161
This commit is contained in:
Qstick 2017-12-20 22:04:24 -05:00
parent 9a0587bc17
commit c83353e7ee

View file

@ -62,7 +62,7 @@ private PagingResource<QueueResource> GetQueue(PagingResource<QueueResource> pag
ordered = ascending ? fullQueue.OrderBy(orderByFunc) : fullQueue.OrderByDescending(orderByFunc);
}
ordered = ordered.ThenByDescending(q => 100 - q.Sizeleft / q.Size * 100);
ordered = ordered.ThenByDescending(q => q.Size == 0 ? 0 : 100 - q.Sizeleft / q.Size * 100);
pagingSpec.Records = ordered.Skip((pagingSpec.Page - 1) * pagingSpec.PageSize).Take(pagingSpec.PageSize).ToList();
pagingSpec.TotalRecords = fullQueue.Count;