From 3d97424dd9053742eea690024903e5a780b9c3da Mon Sep 17 00:00:00 2001 From: phoenix Date: Thu, 4 Apr 2024 09:19:33 +0200 Subject: [PATCH] Quit if there are no jobs to display If there are no jobs found, then it doesn't make sense to continue. This commit adds a check for no jobs, and terminates the program if so. --- cmd/openqa-revtui/openqa-revtui.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/openqa-revtui/openqa-revtui.go b/cmd/openqa-revtui/openqa-revtui.go index eef8b55..8ddb319 100644 --- a/cmd/openqa-revtui/openqa-revtui.go +++ b/cmd/openqa-revtui/openqa-revtui.go @@ -629,6 +629,10 @@ func tui_main(tui *TUI, instance *gopenqa.Instance) error { if err != nil { return fmt.Errorf("error fetching jobs: %s", err) } + if len(jobs) == 0 { + // No reason to continue - there are no jobs to scan + return fmt.Errorf("no jobs found") + } // Failed jobs will be also scanned for comments for _, job := range jobs { state := job.JobState()