mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 18:34:10 -05:00
Backport #28334 by @lng2020 Fix #28328 ``` func (p *PullRequestComment) GetDiffHunk() string { if p == nil || p.DiffHunk == nil { return "" } return *p.DiffHunk } ``` This function in the package `go-github` may return an empty diff. When it's empty, the following code will panic because it access `ss[1]`ec1feedbf5/services/migrations/gitea_uploader.go (L861-L867)
ec1feedbf5/modules/git/diff.go (L97-L101)
Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
This commit is contained in:
parent
5105d2093c
commit
8b590de186
1 changed files with 1 additions and 1 deletions
|
@ -862,7 +862,7 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error {
|
||||||
line := comment.Line
|
line := comment.Line
|
||||||
if line != 0 {
|
if line != 0 {
|
||||||
comment.Position = 1
|
comment.Position = 1
|
||||||
} else {
|
} else if comment.DiffHunk != "" {
|
||||||
_, _, line, _ = git.ParseDiffHunkString(comment.DiffHunk)
|
_, _, line, _ = git.ParseDiffHunkString(comment.DiffHunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue