Skip to content

Commit

Permalink
Merge pull request #438 from tsingbx/main
Browse files Browse the repository at this point in the history
modify stripCommonPrefix to fix panic
  • Loading branch information
xushiwei authored Oct 27, 2024
2 parents 16f0c0b + da0abe4 commit 47c09e3
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 47c09e3

Please sign in to comment.