summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-01-15 16:05:30 +0800
committerGitHub <noreply@github.com>2024-01-15 08:05:30 +0000
commitdf694f6a7d72141e11f12a9cba6f0850a7e8e186 (patch)
tree711858ea5ab5654770b6f30d5535f3803033bdd4 /modules
parent84282c608cdb4ea5006d2b2f81f7d97c631a2b87 (diff)
downloadgitea-df694f6a7d72141e11f12a9cba6f0850a7e8e186.tar.gz
gitea-df694f6a7d72141e11f12a9cba6f0850a7e8e186.zip
Fix nil pointer panic when exec some gitea cli command (#28791) (#28795)
Backport #28791 by @yp05327 panic: ![image](https://github.com/go-gitea/gitea/assets/18380374/7fcde2ad-1d42-4b60-b120-3b60a8926e8e) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/49d9f0ca-e590-4a35-8ca2-1317d1b7c939) Co-authored-by: yp05327 <576951401@qq.com>
Diffstat (limited to 'modules')
-rw-r--r--modules/private/actions.go3
-rw-r--r--modules/private/key.go3
-rw-r--r--modules/private/mail.go3
3 files changed, 9 insertions, 0 deletions
diff --git a/modules/private/actions.go b/modules/private/actions.go
index c924dac2cd..4ec77dc936 100644
--- a/modules/private/actions.go
+++ b/modules/private/actions.go
@@ -22,5 +22,8 @@ func GenerateActionsRunnerToken(ctx context.Context, scope string) (string, Resp
})
resp, extra := requestJSONResp(req, &responseText{})
+ if resp == nil {
+ return "", extra
+ }
return resp.Text, extra
}
diff --git a/modules/private/key.go b/modules/private/key.go
index 6f7cd87796..aa1e8aa56f 100644
--- a/modules/private/key.go
+++ b/modules/private/key.go
@@ -27,5 +27,8 @@ func AuthorizedPublicKeyByContent(ctx context.Context, content string) (string,
req := newInternalRequest(ctx, reqURL, "POST")
req.Param("content", content)
resp, extra := requestJSONResp(req, &responseText{})
+ if resp == nil {
+ return "", extra
+ }
return resp.Text, extra
}
diff --git a/modules/private/mail.go b/modules/private/mail.go
index 82216b346b..699f5e5f42 100644
--- a/modules/private/mail.go
+++ b/modules/private/mail.go
@@ -30,5 +30,8 @@ func SendEmail(ctx context.Context, subject, message string, to []string) (strin
})
resp, extra := requestJSONResp(req, &responseText{})
+ if resp == nil {
+ return "", extra
+ }
return resp.Text, extra
}