Fix crash when cancelling pending tasks (#2527)

This commit is contained in:
InfiniteTF
2022-04-25 08:21:21 +02:00
committed by GitHub
parent 1b91937004
commit 0c2dc17e8e
2 changed files with 7 additions and 1 deletions

View File

@@ -151,8 +151,13 @@ func initJobManager() *job.Manager {
case j := <-c.RemovedJob:
if instance.Config.GetNotificationsEnabled() {
cleanDesc := strings.TrimRight(j.Description, ".")
timeElapsed := j.EndTime.Sub(*j.StartTime)
if j.StartTime == nil {
// Task was never started
return
}
timeElapsed := j.EndTime.Sub(*j.StartTime)
desktop.SendNotification("Task Finished", "Task \""+cleanDesc+"\" is finished in "+formatDuration(timeElapsed)+".")
}
case <-ctx.Done():