Fix crash when trying to deserialize a non-existing scheduled task

pull/754/head
Claus Vium 5 years ago committed by Bond-009
parent b4893b9ac9
commit a05d803d4c

@ -528,14 +528,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
private TaskTriggerInfo[] LoadTriggerSettings()
{
string path = GetConfigurationFilePath();
if (!File.Exists(path))
TaskTriggerInfo[] list = null;
if (File.Exists(path))
{
// File doesn't exist. No biggie. Return defaults.
GetDefaultTriggers();
list = JsonSerializer.DeserializeFromFile<TaskTriggerInfo[]>(path);
}
var list = JsonSerializer.DeserializeFromFile<TaskTriggerInfo[]>(path);
// Return defaults if file doesn't exist.
return list ?? GetDefaultTriggers();
}

Loading…
Cancel
Save