Skip to content

Commit

Permalink
Merge pull request #4 from fumeapp/check-program-nil
Browse files Browse the repository at this point in the history
🦺 make sure program isnt nil
  • Loading branch information
acidjazz authored May 11, 2024
2 parents 57f39a3 + 5a38f54 commit 76c8c2f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions taskin.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func New(tasks Tasks, cfg Config) Runners {
if err != nil {
runners[i].Task.Title = fmt.Sprintf("%s - Error: %s", runners[i].Task.Title, err.Error())
runners[i].State = Failed
program.Send(spinner.TickMsg{})
if program != nil {
program.Send(spinner.TickMsg{})
}
continue
}

Expand All @@ -89,7 +91,9 @@ func New(tasks Tasks, cfg Config) Runners {
runners[i].Children[j].Task.Title = fmt.Sprintf("%s - Error: %s", runners[i].Children[j].Task.Title, err.Error())
runners[i].Children[j].State = Failed
runners[i].State = Failed // Mark parent task as Failed
program.Send(spinner.TickMsg{})
if program != nil {
program.Send(spinner.TickMsg{})
}
break
}
runners[i].Children[j].State = Completed
Expand All @@ -107,7 +111,9 @@ func New(tasks Tasks, cfg Config) Runners {
// If all child tasks are completed, mark the parent task as completed
if allChildrenCompleted && runners[i].State != Failed {
runners[i].State = Completed
program.Send(spinner.TickMsg{})
if program != nil {
program.Send(spinner.TickMsg{})
}
}
}
}()
Expand Down

0 comments on commit 76c8c2f

Please sign in to comment.