diff --git a/commenter/commenter.go b/commenter/commenter.go index f733a20..8918a45 100644 --- a/commenter/commenter.go +++ b/commenter/commenter.go @@ -232,9 +232,10 @@ func parseHunkPositions(patch, filename string) (hi []*hunkInfo, err error) { if err != nil { hunkStart = -1 } - hunkEnd, err := strconv.Atoi(patchGroup[endPos]) - if err != nil { - hunkEnd = -1 + hunkEnd := -1 + hunkLength, err := strconv.Atoi(patchGroup[endPos]) + if err == nil { + hunkEnd = hunkStart + hunkLength - 1 } hunkInfos = append(hunkInfos, &hunkInfo{ hunkStart: hunkStart,