diff --git a/node/basicnode/list.go b/node/basicnode/list.go index 6f7582bb..c9f51f40 100644 --- a/node/basicnode/list.go +++ b/node/basicnode/list.go @@ -31,6 +31,9 @@ func (plainList) LookupByNode(datamodel.Node) (datamodel.Node, error) { return mixins.List{TypeName: "list"}.LookupByNode(nil) } func (n *plainList) LookupByIndex(idx int64) (datamodel.Node, error) { + if idx < 0 { + return nil, datamodel.ErrNotExists{Segment: datamodel.PathSegmentOfInt(idx)} + } if n.Length() <= idx { return nil, datamodel.ErrNotExists{Segment: datamodel.PathSegmentOfInt(idx)} }