Skip to content

Commit 8e9d97c

Browse files
committed
Fixed off by one error
Saw this blow up in the platform today. Silly me.
1 parent efe5523 commit 8e9d97c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index/resolver.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"strings"
1212

1313
"github.com/pb33f/libopenapi/utils"
14-
"slices"
1514
"gopkg.in/yaml.v3"
15+
"slices"
1616
)
1717

1818
// ResolvingError represents an issue the resolver had trying to stitch the tree together.
@@ -521,7 +521,6 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
521521
continue
522522
}
523523

524-
525524
value := node.Content[i+1].Value
526525
value = strings.ReplaceAll(value, "\\\\", "\\")
527526
var locatedRef *Reference
@@ -657,7 +656,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
657656
n.Value == "anyOf" {
658657

659658
// if this is a polymorphic link, we want to follow it and see if it becomes circular
660-
if i+1 <= len(node.Content) && utils.IsNodeMap(node.Content[i+1]) { // check for nested items
659+
if i+1 < len(node.Content) && utils.IsNodeMap(node.Content[i+1]) { // check for nested items
661660
// check if items is present, to indicate an array
662661
if k, v := utils.FindKeyNodeTop("items", node.Content[i+1].Content); v != nil {
663662
if utils.IsNodeMap(v) {

0 commit comments

Comments
 (0)