Merge pull request #4643 from crobibero/empty-lib-null-ref

Fix null reference when getting filters of an empty library
This commit is contained in:
Claus Vium 2020-12-03 07:58:05 +01:00 committed by GitHub
commit 1d3b2e8dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,12 @@ namespace Jellyfin.Api.Controllers
}
};
var itemList = ((Folder)item!).GetItemList(query);
if (item is not Folder folder)
{
return new QueryFiltersLegacy();
}
var itemList = folder.GetItemList(query);
return new QueryFiltersLegacy
{
Years = itemList.Select(i => i.ProductionYear ?? -1)