add null check to subtitle task

pull/702/head
Luke Pulverenti 8 years ago
parent 8201674970
commit 17e5c92549

@ -26,7 +26,7 @@ namespace MediaBrowser.Providers.MediaInfo
private readonly ISubtitleManager _subtitleManager; private readonly ISubtitleManager _subtitleManager;
private readonly IMediaSourceManager _mediaSourceManager; private readonly IMediaSourceManager _mediaSourceManager;
private readonly ILogger _logger; private readonly ILogger _logger;
private IJsonSerializer _json; private readonly IJsonSerializer _json;
public SubtitleScheduledTask(ILibraryManager libraryManager, IJsonSerializer json, IServerConfigurationManager config, ISubtitleManager subtitleManager, ILogger logger, IMediaSourceManager mediaSourceManager) public SubtitleScheduledTask(ILibraryManager libraryManager, IJsonSerializer json, IServerConfigurationManager config, ISubtitleManager subtitleManager, ILogger logger, IMediaSourceManager mediaSourceManager)
{ {
@ -138,12 +138,18 @@ namespace MediaBrowser.Providers.MediaInfo
{ {
try try
{ {
return _json.DeserializeFromFile<Dictionary<string, DateTime>>(path); var result = _json.DeserializeFromFile<Dictionary<string, DateTime>>(path);
if (result != null)
{
return result;
}
} }
catch catch
{ {
return new Dictionary<string, DateTime>();
} }
return new Dictionary<string, DateTime>();
} }
private async Task<bool> DownloadSubtitles(Video video, SubtitleOptions options, CancellationToken cancellationToken) private async Task<bool> DownloadSubtitles(Video video, SubtitleOptions options, CancellationToken cancellationToken)

Loading…
Cancel
Save