Skip to content

Commit 1e5a723

Browse files
committed
Fixes index out of range panic when empty.
1 parent de4687a commit 1e5a723

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

protoc-gen-swagger/genswagger/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er
510510

511511
summary := strings.TrimSpace(paragraphs[0])
512512
description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n"))
513-
if !usingTitle || summary[len(summary)-1] != '.' {
513+
if !usingTitle || summary == "" || summary[len(summary)-1] != '.' {
514514
if len(summary) > 0 {
515515
summaryValue.Set(reflect.ValueOf(summary))
516516
}

0 commit comments

Comments
 (0)