diff options
author | 6543 <6543@obermui.de> | 2022-12-04 11:28:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-04 10:28:57 +0000 |
commit | 46485848fa8580d7d1994e602590d5ac981110b7 (patch) | |
tree | 3e54da6388001cf760f7ca708bff6ecf3e1e28c8 /modules/git | |
parent | 36cbaec54cb4640e23a1edb3ba6d488867f73302 (diff) | |
download | gitea-46485848fa8580d7d1994e602590d5ac981110b7.tar.gz gitea-46485848fa8580d7d1994e602590d5ac981110b7.zip |
On tag/branch-exist check, dont panic if repo is nil (#21787)
fix a panic found in gitea logs
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/repo_branch_nogogit.go | 2 | ||||
-rw-r--r-- | modules/git/repo_tag_nogogit.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/git/repo_branch_nogogit.go b/modules/git/repo_branch_nogogit.go index b1d0df6474..7559513c9b 100644 --- a/modules/git/repo_branch_nogogit.go +++ b/modules/git/repo_branch_nogogit.go @@ -52,7 +52,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 1fb631002b..d3331cf9b7 100644 --- a/modules/git/repo_tag_nogogit.go +++ b/modules/git/repo_tag_nogogit.go @@ -15,7 +15,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 } |