Skip to content

Commit 648a2a4

Browse files
committed
Fix for fileContents = nil
1 parent 579a0a0 commit 648a2a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/repository/files/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func GetContentsListFromTrees(ctx context.Context, repo *repo_model.Repository,
2323
var size int64
2424
for _, file := range treeNames {
2525
fileContents, _ := GetContents(ctx, repo, file, branch, false) // ok if fails, then will be nil
26-
if *fileContents.Content != "" {
26+
if fileContents != nil && *fileContents.Content != "" {
2727
size += fileContents.Size // if content isn't empty (e. g. due to the single blob being too large), add file size to response size
2828
}
2929
if size > setting.API.DefaultMaxResponseSize {

0 commit comments

Comments
 (0)