diff --git a/routers/web/repo/blame.go b/routers/web/repo/blame.go index 0e95a9d023..ab3aecbbe7 100644 --- a/routers/web/repo/blame.go +++ b/routers/web/repo/blame.go @@ -271,7 +271,7 @@ func renderBlame(ctx *context.Context, blameParts []*gitrepo.BlamePart, commitNa unsafeLines := highlight.UnsafeSplitHighlightedLines(highlighted) for i, br := range rows { var line template.HTML - if i < len(rows) { + if i < len(unsafeLines) { line = template.HTML(util.UnsafeBytesToString(unsafeLines[i])) } br.EscapeStatus, br.Code = charset.EscapeControlHTML(line, ctx.Locale)