Skip to content

Commit 782c376

Browse files
GiteaBotviletyy
andauthored
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: 来自村里的小螃蟹 <[email protected]>
1 parent a3b9171 commit 782c376

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

services/repository/files/content.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ func GetContents(ctx context.Context, repo *repo_model.Repository, treePath, ref
214214
if err != nil {
215215
return nil, err
216216
}
217-
contentsResponse.SubmoduleGitURL = &submodule.URL
217+
if submodule != nil && submodule.URL != "" {
218+
contentsResponse.SubmoduleGitURL = &submodule.URL
219+
}
218220
}
219221
// Handle links
220222
if entry.IsRegular() || entry.IsLink() {

0 commit comments

Comments
 (0)