summaryrefslogtreecommitdiffstats
path: root/routers/web/user/setting
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-09-16 11:13:26 +0200
committerGitHub <noreply@github.com>2023-09-16 09:13:26 +0000
commitefecbbaca15e5b28cd6d6356f99612d062678b8a (patch)
treedb5a1c380d6493ee0c729996a7817e103120fe25 /routers/web/user/setting
parentf3f445862e0962b673b5e0d3d12b00c3f7001d85 (diff)
downloadgitea-efecbbaca15e5b28cd6d6356f99612d062678b8a.tar.gz
gitea-efecbbaca15e5b28cd6d6356f99612d062678b8a.zip
Fix NPE when editing OAuth2 applications (#27078)
Fixes #27072 It looks like there are some cases where `ContextUser` is not set here --------- Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'routers/web/user/setting')
-rw-r--r--routers/web/user/setting/oauth2_common.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/web/user/setting/oauth2_common.go b/routers/web/user/setting/oauth2_common.go
index 5786118f50..5ac03e4a74 100644
--- a/routers/web/user/setting/oauth2_common.go
+++ b/routers/web/user/setting/oauth2_common.go
@@ -27,9 +27,8 @@ func (oa *OAuth2CommonHandlers) renderEditPage(ctx *context.Context) {
app := ctx.Data["App"].(*auth.OAuth2Application)
ctx.Data["FormActionPath"] = fmt.Sprintf("%s/%d", oa.BasePathEditPrefix, app.ID)
- if ctx.ContextUser.IsOrganization() {
- err := shared_user.LoadHeaderCount(ctx)
- if err != nil {
+ if ctx.ContextUser != nil && ctx.ContextUser.IsOrganization() {
+ if err := shared_user.LoadHeaderCount(ctx); err != nil {
ctx.ServerError("LoadHeaderCount", err)
return
}
@@ -68,6 +67,7 @@ func (oa *OAuth2CommonHandlers) AddApp(ctx *context.Context) {
ctx.ServerError("GenerateClientSecret", err)
return
}
+
oa.renderEditPage(ctx)
}