Skip to content

Commit

Permalink
check len
Browse files Browse the repository at this point in the history
  • Loading branch information
qawatake committed Sep 3, 2023
1 parent 9cb391d commit 1c15701
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions protoc-gen-openapiv2/internal/genopenapi/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ func (pio *openapiPathItemObject) toYAMLNode() (*yaml.Node, error) {
if err := yaml.Unmarshal(buf.Bytes(), &doc); err != nil {
return nil, err
}
if len(doc.Content) == 0 {
return nil, errors.New("unexpected number of yaml nodes")
}
return doc.Content[0], nil
}

Expand Down

0 comments on commit 1c15701

Please sign in to comment.