diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2017-03-15 21:21:57 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 21:21:57 -0300 |
commit | 43c5469f81851c084fa6ac84d8379ae949c3a05c (patch) | |
tree | 7a3936e276e1298a6a8e30cf9ec0ee034a0ca5d3 | |
parent | efbb895ebe33327630195ac52f10bd3d85bbae00 (diff) | |
parent | 17f403fbcd9bdffc8f9901119482fa200ca572f7 (diff) | |
download | gitea-43c5469f81851c084fa6ac84d8379ae949c3a05c.tar.gz gitea-43c5469f81851c084fa6ac84d8379ae949c3a05c.zip |
Merge pull request #1258 from ethantkoenig/fix/access
Fix nil-dereference bug
-rw-r--r-- | modules/context/repo.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 9e37ae3fbf..895640a823 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -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 |