Merge pull request #8503 from Bond-009/ThrowIfNull

This commit is contained in:
Claus Vium
2022-10-07 07:50:39 +02:00
committed by GitHub
65 changed files with 160 additions and 622 deletions

View File

@@ -29,10 +29,7 @@ namespace MediaBrowser.Model.Cryptography
public PasswordHash(string id, byte[] hash, byte[] salt, Dictionary<string, string> parameters)
{
if (id == null)
{
throw new ArgumentNullException(nameof(id));
}
ArgumentNullException.ThrowIfNull(id);
if (id.Length == 0)
{

View File

@@ -565,10 +565,7 @@ namespace MediaBrowser.Model.Dlna
private StreamInfo BuildVideoItem(MediaSourceInfo item, VideoOptions options)
{
if (item == null)
{
throw new ArgumentNullException(nameof(item));
}
ArgumentNullException.ThrowIfNull(item);
StreamInfo playlistItem = new StreamInfo
{

View File

@@ -28,10 +28,7 @@ namespace MediaBrowser.Model.Entities
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, string name)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
ArgumentNullException.ThrowIfNull(instance);
return instance.TryGetProviderId(name, out _);
}
@@ -56,10 +53,7 @@ namespace MediaBrowser.Model.Entities
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool TryGetProviderId(this IHasProviderIds instance, string name, [NotNullWhen(true)] out string? id)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
ArgumentNullException.ThrowIfNull(instance);
if (instance.ProviderIds == null)
{
@@ -121,10 +115,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="value">The value.</param>
public static void SetProviderId(this IHasProviderIds instance, string name, string? value)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
ArgumentNullException.ThrowIfNull(instance);
// If it's null remove the key from the dictionary
if (string.IsNullOrEmpty(value))