aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index a9f459986..eee7aeea3 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -139,8 +139,15 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- using FileStream jsonStream = File.OpenRead(path);
- _lastExecutionResult = JsonSerializer.DeserializeAsync<TaskResult>(jsonStream, JsonDefaults.GetOptions()).GetAwaiter().GetResult();
+ var jsonString = File.ReadAllText(path);
+ if (!string.IsNullOrWhiteSpace(jsonString))
+ {
+ _lastExecutionResult = JsonSerializer.Deserialize<TaskResult>(jsonString, JsonDefaults.GetOptions());
+ }
+ else
+ {
+ _logger.LogDebug("Scheduled Task history file {path} is empty. Skipping deserialization.", path);
+ }
}
catch (Exception ex)
{