Skip to content

Commit

Permalink
modify stripCommonPrefix to fix panic
Browse files Browse the repository at this point in the history
  • Loading branch information
tsingbx committed Sep 25, 2024
1 parent 16f0c0b commit da0abe4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/go/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func stripCommonPrefix(lines []string) {
last := lines[len(lines)-1]
closing := "*/"
i := strings.Index(last, closing) // i >= 0 (closing is always present)
if isBlank(last[0:i]) {
if i >= 0 && isBlank(last[0:i]) {
// last line only contains closing */
if lineOfStars {
closing = " */" // add blank to align final star
Expand Down

0 comments on commit da0abe4

Please sign in to comment.