return false when providerid is null or empty

This commit is contained in:
cvium 2021-03-03 09:09:57 +01:00
parent 8f99bdd07c
commit 664c5da317
2 changed files with 9 additions and 7 deletions

View file

@ -50,13 +50,15 @@ namespace MediaBrowser.Model.Entities
throw new ArgumentNullException(nameof(instance)); throw new ArgumentNullException(nameof(instance));
} }
if (instance.ProviderIds == null) var foundProviderId = instance.ProviderIds.TryGetValue(name, out id);
// This occurs when searching with Identify (and possibly in other places)
if (string.IsNullOrEmpty(id))
{ {
id = null; id = null;
return false; foundProviderId = false;
} }
return instance.ProviderIds.TryGetValue(name, out id); return foundProviderId;
} }
/// <summary> /// <summary>

View file

@ -869,14 +869,14 @@ namespace MediaBrowser.Providers.Manager
} }
} }
} }
catch (Exception) #pragma warning disable CA1031 // do not catch general exception types
catch (Exception ex)
#pragma warning restore CA1031 // do not catch general exception types
{ {
// Logged at lower levels _logger.LogError(ex, "Provider {ProviderName} failed to retrieve search results", provider.Name);
} }
} }
// _logger.LogDebug("Returning search results {0}", _json.SerializeToString(resultList));
return resultList; return resultList;
} }