Skip to content

Commit f33c957

Browse files
committed
Fix null err access
1 parent a27d5ef commit f33c957

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

backend/server.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,11 +729,16 @@ func server(jobsystem JobSystem, config ConfigRoot) {
729729
}
730730

731731
status, err := jobsystem.Status(ticket.Id)
732-
if err != nil || status != StatusComplete {
732+
if err != nil {
733733
http.Error(w, err.Error(), http.StatusBadRequest)
734734
return
735735
}
736736

737+
if status != StatusComplete {
738+
http.Error(w, "Job is not complete", http.StatusBadRequest)
739+
return
740+
}
741+
737742
name := "mmseqs_results_" + string(ticket.Id) + ".tar.gz"
738743
path := filepath.Join(filepath.Clean(config.Paths.Results), string(ticket.Id), name)
739744
if _, err := os.Stat(path); os.IsNotExist(err) {
@@ -762,11 +767,16 @@ func server(jobsystem JobSystem, config ConfigRoot) {
762767
}
763768

764769
status, err := jobsystem.Status(ticket.Id)
765-
if err != nil || status != StatusComplete {
770+
if err != nil {
766771
http.Error(w, err.Error(), http.StatusBadRequest)
767772
return
768773
}
769774

775+
if status != StatusComplete {
776+
http.Error(w, "Job is not complete", http.StatusBadRequest)
777+
return
778+
}
779+
770780
name := "folddisco_results_" + string(ticket.Id) + ".tar.gz"
771781
path := filepath.Join(filepath.Clean(config.Paths.Results), string(ticket.Id), name)
772782
if _, err := os.Stat(path); os.IsNotExist(err) {

0 commit comments

Comments
 (0)