diff options
author | 来自村里的小螃蟹 <yystopf@163.com> | 2023-03-21 06:26:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 18:26:01 -0400 |
commit | f83246edb263c039904ee9723f5dfc2a46f2259f (patch) | |
tree | cdd48466b20987110751ea25a37d5ce6062bf1cc | |
parent | a8c30a45fa49a3a551b1dca882960008c254bb3d (diff) | |
download | gitea-f83246edb263c039904ee9723f5dfc2a46f2259f.tar.gz gitea-f83246edb263c039904ee9723f5dfc2a46f2259f.zip |
fix submodule is nil panic (#23588)
#23587
submodule path is nil
It is panic a nil error
---------
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
-rw-r--r-- | services/repository/files/content.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/repository/files/content.go b/services/repository/files/content.go index 31827e8846..6f6dc91d85 100644 --- a/services/repository/files/content.go +++ b/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() { |