1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Merge pull request #1258 from ethantkoenig/fix/access

Fix nil-dereference bug
This commit is contained in:
Andrey Nering 2017-03-15 21:21:57 -03:00 committed by GitHub
commit 43c5469f81

View File

@ -219,7 +219,11 @@ func RepoAssignment(args ...bool) macaron.Handler {
if ctx.IsSigned && ctx.User.IsAdmin {
ctx.Repo.AccessMode = models.AccessModeOwner
} else {
mode, err := models.AccessLevel(ctx.User.ID, repo)
var userID int64
if ctx.User != nil {
userID = ctx.User.ID
}
mode, err := models.AccessLevel(userID, repo)
if err != nil {
ctx.Handle(500, "AccessLevel", err)
return