diff options
author | coldWater <forsaken628@gmail.com> | 2024-03-19 10:20:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 02:20:36 +0000 |
commit | 0e183d81fc5283f9d2047472de580e4f04a046c1 (patch) | |
tree | 8f08d554fb9ed6c2f48d2e77e61f1ac348b76155 /modules/git | |
parent | 1f0d31ce8fdfc8c32f84e4e0801c2d04b727bbd8 (diff) | |
download | gitea-0e183d81fc5283f9d2047472de580e4f04a046c1.tar.gz gitea-0e183d81fc5283f9d2047472de580e4f04a046c1.zip |
Fix missing error check of bufio.Scanner (#29882)
maybe more
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/commit.go | 5 | ||||
-rw-r--r-- | modules/git/repo_stats.go | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go index facb632bd9..789a2e8f69 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "errors" + "fmt" "io" "os/exec" "strconv" @@ -396,6 +397,10 @@ func (c *Commit) GetSubModules() (*ObjectCache, error) { } } } + err = scanner.Err() + if err != nil { + return nil, fmt.Errorf("scan: %w", err) + } return c.submoduleCache, nil } diff --git a/modules/git/repo_stats.go b/modules/git/repo_stats.go index 41f94e24f9..ce82946873 100644 --- a/modules/git/repo_stats.go +++ b/modules/git/repo_stats.go @@ -124,6 +124,10 @@ func (repo *Repository) GetCodeActivityStats(fromTime time.Time, branch string) } } } + err = scanner.Err() + if err != nil { + return fmt.Errorf("scan: %w", err) + } a := make([]*CodeActivityAuthor, 0, len(authors)) for _, v := range authors { a = append(a, v) |