Skip to content

Commit

Permalink
API: Fix null pointer in attempt to Sudo if not logged in (Backport g…
Browse files Browse the repository at this point in the history
…o-gitea#5872)

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Jan 28, 2019
1 parent d3a334d commit 355698e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func sudo() macaron.Handler {
}

if len(sudo) > 0 {
if ctx.User.IsAdmin {
if ctx.IsSigned && ctx.User.IsAdmin {
user, err := models.GetUserByName(sudo)
if err != nil {
if models.IsErrUserNotExist(err) {
Expand Down

0 comments on commit 355698e

Please sign in to comment.