diff --git a/Shoko.Server/API/v3/Controllers/ImageController.cs b/Shoko.Server/API/v3/Controllers/ImageController.cs index 93e9130ff..2888013d8 100644 --- a/Shoko.Server/API/v3/Controllers/ImageController.cs +++ b/Shoko.Server/API/v3/Controllers/ImageController.cs @@ -15,6 +15,7 @@ using Shoko.Server.Settings; using Shoko.Server.Utilities; +#nullable enable namespace Shoko.Server.API.v3.Controllers; [ApiController] @@ -159,7 +160,7 @@ public ActionResult GetRandomImageForType([FromRoute] Image.ImageType imageType) public ActionResult GetRandomImageMetadataForType( [FromRoute] Image.ImageType imageType, [FromQuery] IncludeOnlyFilter includeRestricted = IncludeOnlyFilter.False, - [FromQuery, ModelBinder(typeof(CommaDelimitedModelBinder))] HashSet seriesType = null, + [FromQuery, ModelBinder(typeof(CommaDelimitedModelBinder))] HashSet? seriesType = null, [FromQuery, Range(0, 100)] int maxAttempts = 5 ) { @@ -184,7 +185,7 @@ public ActionResult GetRandomImageMetadataForType( var image = new Image(metadata); var series = ImageUtils.GetFirstSeriesForImage(metadata); - if (series.AniDB_Anime is not { } anime) + if (series?.AniDB_Anime is not { } anime) continue; if (includeRestricted != IncludeOnlyFilter.True)