fix submodule is nil panic (#23588) (#23601)

Backport #23588 by @viletyy

#23587  
submodule path is nil 
It is panic a nil error

Co-authored-by: 来自村里的小螃蟹 <yystopf@163.com>
pull/23603/head^2
Giteabot 2 years ago committed by GitHub
parent a3b917151c
commit 782c376c8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      services/repository/files/content.go

@ -214,7 +214,9 @@ func GetContents(ctx context.Context, repo *repo_model.Repository, treePath, ref
if err != nil {
return nil, err
}
contentsResponse.SubmoduleGitURL = &submodule.URL
if submodule != nil && submodule.URL != "" {
contentsResponse.SubmoduleGitURL = &submodule.URL
}
}
// Handle links
if entry.IsRegular() || entry.IsLink() {

Loading…
Cancel
Save