mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
avoid Take(0) when limit == 0 (#14608)
Co-authored-by: Evan <evan@MacBook-Pro.local>
This commit is contained in:
@@ -240,12 +240,9 @@ namespace Jellyfin.LiveTv.Channels
|
||||
var all = channels;
|
||||
var totalCount = all.Count;
|
||||
|
||||
if (query.StartIndex.HasValue || query.Limit.HasValue)
|
||||
{
|
||||
int startIndex = query.StartIndex ?? 0;
|
||||
int count = query.Limit is null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
||||
all = all.GetRange(startIndex, count);
|
||||
}
|
||||
int startIndex = query.StartIndex ?? 0;
|
||||
int count = (query.Limit ?? 0) > 0 ? Math.Min(query.Limit.Value, totalCount - startIndex) : totalCount - startIndex;
|
||||
all = all.GetRange(query.StartIndex ?? 0, count);
|
||||
|
||||
if (query.RefreshLatestChannelItems)
|
||||
{
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace Jellyfin.LiveTv
|
||||
GenreIds = query.GenreIds
|
||||
};
|
||||
|
||||
if (query.Limit.HasValue)
|
||||
if (query.Limit.HasValue && query.Limit.Value > 0)
|
||||
{
|
||||
internalQuery.Limit = Math.Max(query.Limit.Value * 4, 200);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ namespace Jellyfin.LiveTv
|
||||
|
||||
IEnumerable<BaseItem> programs = orderedPrograms;
|
||||
|
||||
if (query.Limit.HasValue)
|
||||
if (query.Limit.HasValue && query.Limit.Value > 0)
|
||||
{
|
||||
programs = programs.Take(query.Limit.Value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user