Skip to content

Commit

Permalink
On tag/branch-exist check, dont panic if repo is nil (#21787)
Browse files Browse the repository at this point in the history
fix a panic found in gitea logs
  • Loading branch information
6543 authored Dec 4, 2022
1 parent 36cbaec commit 4648584
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 @@ -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
}

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 @@ -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
}

Expand Down

0 comments on commit 4648584

Please sign in to comment.