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>
This commit is contained in:
parent
f3f445862e
commit
efecbbaca1
|
@ -27,9 +27,8 @@ func (oa *OAuth2CommonHandlers) renderEditPage(ctx *context.Context) {
|
||||||
app := ctx.Data["App"].(*auth.OAuth2Application)
|
app := ctx.Data["App"].(*auth.OAuth2Application)
|
||||||
ctx.Data["FormActionPath"] = fmt.Sprintf("%s/%d", oa.BasePathEditPrefix, app.ID)
|
ctx.Data["FormActionPath"] = fmt.Sprintf("%s/%d", oa.BasePathEditPrefix, app.ID)
|
||||||
|
|
||||||
if ctx.ContextUser.IsOrganization() {
|
if ctx.ContextUser != nil && ctx.ContextUser.IsOrganization() {
|
||||||
err := shared_user.LoadHeaderCount(ctx)
|
if err := shared_user.LoadHeaderCount(ctx); err != nil {
|
||||||
if err != nil {
|
|
||||||
ctx.ServerError("LoadHeaderCount", err)
|
ctx.ServerError("LoadHeaderCount", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -68,6 +67,7 @@ func (oa *OAuth2CommonHandlers) AddApp(ctx *context.Context) {
|
||||||
ctx.ServerError("GenerateClientSecret", err)
|
ctx.ServerError("GenerateClientSecret", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
oa.renderEditPage(ctx)
|
oa.renderEditPage(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue