avoid Take(0) when limit == 0 (#14608)

Co-authored-by: Evan <evan@MacBook-Pro.local>
This commit is contained in:
evan314159
2025-12-09 12:15:46 +08:00
committed by GitHub
parent f24e80701c
commit 8b2a8b94b6
7 changed files with 26 additions and 39 deletions

View File

@@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.Library
results = results.GetRange(query.StartIndex.Value, totalRecordCount - query.StartIndex.Value);
}
if (query.Limit.HasValue)
if (query.Limit.HasValue && query.Limit.Value > 0)
{
results = results.GetRange(0, Math.Min(query.Limit.Value, results.Count));
}

View File

@@ -266,7 +266,7 @@ namespace Emby.Server.Implementations.TV
items = items.Skip(query.StartIndex.Value);
}
if (query.Limit.HasValue)
if (query.Limit.HasValue && query.Limit.Value > 0)
{
items = items.Take(query.Limit.Value);
}