diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index b256802..a290b31 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -86,10 +86,10 @@ public class AdminController : ControllerBase /// Helper method to safely check if a dynamic cache result has a value /// Handles the case where JsonElement cannot be compared to null directly /// - private static bool HasValue(dynamic? obj) + private static bool HasValue(object? obj) { if (obj == null) return false; - if (obj is JsonElement jsonEl) return jsonEl.ValueKind != JsonValueKind.Null; + if (obj is JsonElement jsonEl) return jsonEl.ValueKind != JsonValueKind.Null && jsonEl.ValueKind != JsonValueKind.Undefined; return true; } diff --git a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs index 611ccb9..dae5f56 100644 --- a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs +++ b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs @@ -48,10 +48,10 @@ public class SpotifyTrackMatchingService : BackgroundService /// Helper method to safely check if a dynamic cache result has a value /// Handles the case where JsonElement cannot be compared to null directly /// - private static bool HasValue(dynamic? obj) + private static bool HasValue(object? obj) { if (obj == null) return false; - if (obj is JsonElement jsonEl) return jsonEl.ValueKind != JsonValueKind.Null; + if (obj is JsonElement jsonEl) return jsonEl.ValueKind != JsonValueKind.Null && jsonEl.ValueKind != JsonValueKind.Undefined; return true; }