Merge pull request #955 from ploughpuff/avoid

Avoid exceptions due to folder and file not found
This commit is contained in:
Vasily 2019-02-21 15:05:31 +03:00 committed by GitHub
commit 785fa76ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -43,13 +43,15 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var jsonFile = path + ".json";
if (!File.Exists(jsonFile))
{
return new List<T>();
}
try
{
return _jsonSerializer.DeserializeFromFile<List<T>>(jsonFile) ?? new List<T>();
}
catch (FileNotFoundException)
{
}
catch (IOException)
{
}
@ -57,6 +59,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
Logger.LogError(ex, "Error deserializing {jsonFile}", jsonFile);
}
return new List<T>();
}

View file

@ -170,7 +170,7 @@ namespace MediaBrowser.Api
/// </summary>
private void DeleteEncodedMediaCache()
{
var path = _config.ApplicationPaths.TranscodingTempPath;
var path = _config.ApplicationPaths.GetTranscodingTempPath();
foreach (var file in _fileSystem.GetFilePaths(path, true))
{