mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-29 09:31:11 -05:00
Merge pull request #1258 from ethantkoenig/fix/access
Fix nil-dereference bug
This commit is contained in:
commit
43c5469f81
1 changed files with 5 additions and 1 deletions
|
@ -219,7 +219,11 @@ func RepoAssignment(args ...bool) macaron.Handler {
|
||||||
if ctx.IsSigned && ctx.User.IsAdmin {
|
if ctx.IsSigned && ctx.User.IsAdmin {
|
||||||
ctx.Repo.AccessMode = models.AccessModeOwner
|
ctx.Repo.AccessMode = models.AccessModeOwner
|
||||||
} else {
|
} 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 {
|
if err != nil {
|
||||||
ctx.Handle(500, "AccessLevel", err)
|
ctx.Handle(500, "AccessLevel", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue