diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-03-14 22:13:54 -0400 |
---|---|---|
committer | Ethan Koenig <ethantkoenig@gmail.com> | 2017-03-15 14:09:44 -0400 |
commit | 17f403fbcd9bdffc8f9901119482fa200ca572f7 (patch) | |
tree | 99757f14c111f2caecd55f7f7379c9c6f81161fd /modules | |
parent | 780cb692d64edfadea6f79fbbad2ef033cdbe796 (diff) | |
download | gitea-17f403fbcd9bdffc8f9901119482fa200ca572f7.tar.gz gitea-17f403fbcd9bdffc8f9901119482fa200ca572f7.zip |
Fix nil-dereference bug
Diffstat (limited to 'modules')
-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 |