mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-21 01:14:31 +08:00
API: Fix null pointer in attempt to Sudo if not logged in (#5872)
Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
5f4a40c4a3
commit
bf47f70c3b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user