From 44cc53627b5c7da1750371e7c1cb559befed3481 Mon Sep 17 00:00:00 2001 From: Craig Hawker Date: Thu, 20 Jul 2023 08:13:07 +0100 Subject: [PATCH] Fix for #110 - checked start has a value before referencing --- .../TaskQueueBackgroundOperations/TaskInformation.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MFiles.VAF.Extensions/TaskQueueBackgroundOperations/TaskInformation.cs b/MFiles.VAF.Extensions/TaskQueueBackgroundOperations/TaskInformation.cs index 5443a3bc..7cd09a62 100644 --- a/MFiles.VAF.Extensions/TaskQueueBackgroundOperations/TaskInformation.cs +++ b/MFiles.VAF.Extensions/TaskQueueBackgroundOperations/TaskInformation.cs @@ -93,7 +93,9 @@ public TimeSpan GetElapsedTime() { // If we are running then it's the difference between now and started. if (this.CurrentTaskState == MFTaskState.MFTaskStateInProgress) - return DateTime.UtcNow.Subtract(this.Started.Value); + return this.Started.HasValue + ? DateTime.UtcNow.Subtract(this.Started.Value) + : TimeSpan.Zero; // If we have no start or last activity date then return zero. if (false == this.Started.HasValue