aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo')
-rw-r--r--routers/web/repo/branch.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go
index a7588d275d..43e6d43134 100644
--- a/routers/web/repo/branch.go
+++ b/routers/web/repo/branch.go
@@ -126,6 +126,10 @@ func RestoreBranchPost(ctx *context.Context) {
log.Error("GetDeletedBranchByID: %v", err)
ctx.Flash.Error(ctx.Tr("repo.branch.restore_failed", branchName))
return
+ } else if deletedBranch == nil {
+ log.Debug("RestoreBranch: Can't restore branch[%d] '%s', as it does not exist", branchID, branchName)
+ ctx.Flash.Error(ctx.Tr("repo.branch.restore_failed", branchName))
+ return
}
if err := git.Push(ctx, ctx.Repo.Repository.RepoPath(), git.PushOptions{