API: Fix null pointer in attempt to Sudo if not logged in (#5872)

Signed-off-by: Andrew Thornton <art27@cantab.net>
release/v1.15
zeripath 2019-01-28 14:13:59 +00:00 committed by GitHub
parent 5f4a40c4a3
commit bf47f70c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ func sudo() macaron.Handler {
} }
if len(sudo) > 0 { if len(sudo) > 0 {
if ctx.User.IsAdmin { if ctx.IsSigned && ctx.User.IsAdmin {
user, err := models.GetUserByName(sudo) user, err := models.GetUserByName(sudo)
if err != nil { if err != nil {
if models.IsErrUserNotExist(err) { if models.IsErrUserNotExist(err) {