Fix null reference when getting filters of an empty library

This commit is contained in:
crobibero 2020-12-02 07:42:25 -07:00
parent 3b4f86579b
commit 41e127d1d2
1 changed files with 6 additions and 1 deletions

View File

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