From 8e2ff338d8df85c2acd79e264f2866f7ffe10e95 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:46:51 +0200 Subject: [PATCH] Fix panic if forge is unreachable (#3944) --- server/api/pipeline.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/api/pipeline.go b/server/api/pipeline.go index 591a6db66..f1e4b41a0 100644 --- a/server/api/pipeline.go +++ b/server/api/pipeline.go @@ -64,7 +64,11 @@ func CreatePipeline(c *gin.Context) { user := session.User(c) - lastCommit, _ := _forge.BranchHead(c, user, repo, opts.Branch) + lastCommit, err := _forge.BranchHead(c, user, repo, opts.Branch) + if err != nil { + _ = c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("could not fetch branch head: %w", err)) + return + } tmpPipeline := createTmpPipeline(model.EventManual, lastCommit, user, &opts)