mirror of
https://gitee.com/gitea/gitea
synced 2025-11-04 00:20:25 +08:00
On tag/branch-exist check, dont panic if repo is nil (#21787)
fix a panic found in gitea logs
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user