Backport #20509
This commit is contained in:
parent
fa46d66835
commit
4ed32e79b6
1 changed files with 8 additions and 4 deletions
|
@ -902,11 +902,15 @@ func renderCode(ctx *context.Context) {
|
|||
ctx.Data["PageIsViewCode"] = true
|
||||
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
reallyEmpty, err := ctx.Repo.GitRepo.IsEmpty()
|
||||
reallyEmpty := true
|
||||
var err error
|
||||
if ctx.Repo.GitRepo != nil {
|
||||
reallyEmpty, err = ctx.Repo.GitRepo.IsEmpty()
|
||||
if err != nil {
|
||||
ctx.ServerError("GitRepo.IsEmpty", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if reallyEmpty {
|
||||
ctx.HTML(http.StatusOK, tplRepoEMPTY)
|
||||
return
|
||||
|
|
Reference in a new issue