From 41e127d1d2f82ea879b11a35b92dfb537554193d Mon Sep 17 00:00:00 2001 From: crobibero Date: Wed, 2 Dec 2020 07:42:25 -0700 Subject: [PATCH] Fix null reference when getting filters of an empty library --- Jellyfin.Api/Controllers/FilterController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Api/Controllers/FilterController.cs b/Jellyfin.Api/Controllers/FilterController.cs index 31cb9e273..0e1af66dc 100644 --- a/Jellyfin.Api/Controllers/FilterController.cs +++ b/Jellyfin.Api/Controllers/FilterController.cs @@ -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)