2
0
Эх сурвалжийг харах

fix nil pointer error in GetLatestWorkflowRun

Mohammed Nafees 4 жил өмнө
parent
commit
9d8fc74f53

+ 2 - 2
api/server/shared/commonutils/git_utils.go

@@ -22,7 +22,7 @@ func GetLatestWorkflowRun(client *github.Client, owner, repo, filename, branch s
 		},
 	)
 
-	if ghResponse.StatusCode == http.StatusNotFound {
+	if ghResponse != nil && ghResponse.StatusCode == http.StatusNotFound {
 		return nil, ErrWorkflowNotFound
 	}
 
@@ -30,7 +30,7 @@ func GetLatestWorkflowRun(client *github.Client, owner, repo, filename, branch s
 		return nil, err
 	}
 
-	if workflowRuns.GetTotalCount() == 0 {
+	if workflowRuns == nil || workflowRuns.GetTotalCount() == 0 {
 		return nil, ErrNoWorkflowRuns
 	}