From a68e13af35254a96a98f8a18ade83853a29d7ea0 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Tue, 11 Mar 2025 23:34:44 +0200 Subject: [PATCH] Fix notifications when poster is not found (#89) --- .../Verticals/Notifications/NotificationPublisher.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs b/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs index 3d7aed3..0577a96 100644 --- a/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs +++ b/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs @@ -128,9 +128,9 @@ public class NotificationPublisher : INotificationPublisher { Uri? image = instanceType switch { - InstanceType.Sonarr => record.Series!.Images.FirstOrDefault(x => x.CoverType == "poster")?.RemoteUrl, - InstanceType.Radarr => record.Movie!.Images.FirstOrDefault(x => x.CoverType == "poster")?.RemoteUrl, - InstanceType.Lidarr => record.Album!.Images.FirstOrDefault(x => x.CoverType == "cover")?.Url, + InstanceType.Sonarr => record.Series?.Images?.FirstOrDefault(x => x.CoverType == "poster")?.RemoteUrl, + InstanceType.Radarr => record.Movie?.Images?.FirstOrDefault(x => x.CoverType == "poster")?.RemoteUrl, + InstanceType.Lidarr => record.Album?.Images?.FirstOrDefault(x => x.CoverType == "cover")?.Url, _ => throw new ArgumentOutOfRangeException(nameof(instanceType)) };