mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 10:04:44 +01:00
add error handling to recording parsing
This commit is contained in:
@@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
try
|
||||
{
|
||||
return _jsonSerializer.DeserializeFromFile<List<T>>(jsonFile);
|
||||
return _jsonSerializer.DeserializeFromFile<List<T>>(jsonFile) ?? new List<T>();
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
@@ -69,6 +69,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private void UpdateList(List<T> newList)
|
||||
{
|
||||
if (newList == null)
|
||||
{
|
||||
throw new ArgumentNullException("newList");
|
||||
}
|
||||
|
||||
var file = _dataPath + ".json";
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(file));
|
||||
|
||||
@@ -81,6 +86,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
public virtual void Update(T item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
|
||||
var list = GetAll().ToList();
|
||||
|
||||
var index = list.FindIndex(i => EqualityComparer(i, item));
|
||||
@@ -97,6 +107,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
public virtual void Add(T item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
|
||||
var list = GetAll().ToList();
|
||||
|
||||
if (list.Any(i => EqualityComparer(i, item)))
|
||||
|
||||
Reference in New Issue
Block a user