diff options
author | JakobDev <jakobdev@gmx.de> | 2023-09-16 11:13:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 09:13:26 +0000 |
commit | efecbbaca15e5b28cd6d6356f99612d062678b8a (patch) | |
tree | db5a1c380d6493ee0c729996a7817e103120fe25 /routers/web/user/setting | |
parent | f3f445862e0962b673b5e0d3d12b00c3f7001d85 (diff) | |
download | gitea-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.go | 6 |
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) } |