mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-28 21:19:18 +08:00
Fix nil-dereference bug
This commit is contained in:
parent
780cb692d6
commit
17f403fbcd
@ -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 New Issue
Block a user