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

@@ -455,7 +455,7 @@ namespace MediaBrowser.Controller.Entities
var itemsArray = totalRecordLimit.HasValue ? items.Take(totalRecordLimit.Value).ToArray() : items.ToArray();
var totalCount = itemsArray.Length;
if (query.Limit.HasValue)
if (query.Limit.HasValue && query.Limit.Value > 0)
{
itemsArray = itemsArray.Skip(query.StartIndex ?? 0).Take(query.Limit.Value).ToArray();
}