Skip to content

Commit

Permalink
On Tag/Branch Exist Check, dont panic if repo is nil (#21787) (#21789)
Browse files Browse the repository at this point in the history
Backport #21787

Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
  • Loading branch information
3 people authored Dec 5, 2022
1 parent 8188cdf commit ee6d512
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/git/repo_branch_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion modules/git/repo_tag_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit ee6d512

Please sign in to comment.