On tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)

backport #21787
This commit is contained in:
6543 authored and GitHub committed 2022-12-04 10:29:19 +00:00
1 parent c7770fa502
commit 9819a47717
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -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
}