diff options
author | zeripath <art27@cantab.net> | 2019-01-28 14:13:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-28 14:13:59 +0000 |
commit | bf47f70c3b4a70c55680ad6d0436593242e60d9e (patch) | |
tree | cb64d93d0df4649fc090fcd8030385016594d986 /routers/api | |
parent | 5f4a40c4a3d8afaaf9f3b43ded441a26c22c7f3b (diff) | |
download | gitea-bf47f70c3b4a70c55680ad6d0436593242e60d9e.tar.gz gitea-bf47f70c3b4a70c55680ad6d0436593242e60d9e.zip |
API: Fix null pointer in attempt to Sudo if not logged in (#5872)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/api.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 2787d01a04..d8f78550c8 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -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) { |