aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-12-04 11:29:19 +0100
committerGitHub <noreply@github.com>2022-12-04 10:29:19 +0000
commit9819a477176fa6a9c037da3f7b7d9e7b6c2b456f (patch)
tree7dddf58df10d32dac2fd44080df26ac7539d2ea6
parentc7770fa50213b979ba0a3cd20f9008268e398140 (diff)
downloadgitea-9819a477176fa6a9c037da3f7b7d9e7b6c2b456f.tar.gz
gitea-9819a477176fa6a9c037da3f7b7d9e7b6c2b456f.zip
On tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)
backport #21787
-rw-r--r--modules/git/repo_branch_nogogit.go2
-rw-r--r--modules/git/repo_tag_nogogit.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/git/repo_branch_nogogit.go b/modules/git/repo_branch_nogogit.go
index 95c3718841..26e20ba116 100644
--- a/modules/git/repo_branch_nogogit.go
+++ b/modules/git/repo_branch_nogogit.go
@@ -53,7 +53,7 @@ func (repo *Repository) IsReferenceExist(name string) bool {
// IsBranchExist returns true if given branch exists in current repository.
func (repo *Repository) IsBranchExist(name string) bool {
- if name == "" {
+ if repo == nil || name == "" {
return false
}
diff --git a/modules/git/repo_tag_nogogit.go b/modules/git/repo_tag_nogogit.go
index 5d3aace52f..0bb0da21bf 100644
--- a/modules/git/repo_tag_nogogit.go
+++ b/modules/git/repo_tag_nogogit.go
@@ -16,7 +16,7 @@ import (
// IsTagExist returns true if given tag exists in the repository.
func (repo *Repository) IsTagExist(name string) bool {
- if name == "" {
+ if repo == nil || name == "" {
return false
}