-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Tvdb Client usage more resilient and robust (#112)
* catch JsonException * refactor duplicate code and catch JsonException
- Loading branch information
Showing
7 changed files
with
372 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Jellyfin.Plugin.Tvdb; | ||
|
||
internal static class CollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Adds the <paramref name="item"/> if it is not <see langword="null"/>. | ||
/// </summary> | ||
/// <typeparam name="T">Data type of the collection items.</typeparam> | ||
/// <param name="collection">Input <see cref="ICollection"/>.</param> | ||
/// <param name="item">Item to add.</param> | ||
/// <returns>The input collection.</returns> | ||
public static ICollection<T> AddIfNotNull<T>(this ICollection<T> collection, T? item) | ||
{ | ||
if (item != null) | ||
{ | ||
collection.Add(item); | ||
} | ||
|
||
return collection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.