Skip to content

Commit 2979953

Browse files
authored
API: Fix null pointer in attempt to Sudo if not logged in (#5872) (#5884)
Backport of #5872 to v1.7 Signed-off-by: Andrew Thornton <[email protected]>
1 parent d3a334d commit 2979953

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/api/v1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func sudo() macaron.Handler {
8585
}
8686

8787
if len(sudo) > 0 {
88-
if ctx.User.IsAdmin {
88+
if ctx.IsSigned && ctx.User.IsAdmin {
8989
user, err := models.GetUserByName(sudo)
9090
if err != nil {
9191
if models.IsErrUserNotExist(err) {

0 commit comments

Comments
 (0)