Fix a panic bug when head repository deleting (#30674)

When visiting a pull request files which head repository has been
deleted, it will panic because headrepo is nil.
pull/30667/head^2
Lunny Xiao 7 months ago committed by GitHub
parent 2ad9ef4984
commit 8b3632435e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      routers/web/repo/pull.go

@ -863,7 +863,6 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
if pull.HeadRepo != nil {
ctx.Data["SourcePath"] = pull.HeadRepo.Link() + "/src/branch/" + util.PathEscapeSegments(pull.HeadBranch)
}
if !pull.HasMerged && ctx.Doer != nil {
perm, err := access_model.GetUserRepoPermission(ctx, pull.HeadRepo, ctx.Doer)
@ -881,6 +880,7 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
}
}
}
}
ctx.HTML(http.StatusOK, tplPullFiles)
}

Loading…
Cancel
Save