mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-02 22:52:51 +02:00
tpl/collections: Return en empty slice in after instead of error
When the given index is out of bounds. So it can safely be used with `with` etc. without extra length checking. Fixes #4894
This commit is contained in:
@@ -74,7 +74,7 @@ func (ns *Namespace) After(index interface{}, seq interface{}) (interface{}, err
|
||||
}
|
||||
|
||||
if indexv >= seqv.Len() {
|
||||
return nil, errors.New("no items left")
|
||||
return seqv.Slice(0, 0).Interface(), nil
|
||||
}
|
||||
|
||||
return seqv.Slice(indexv, seqv.Len()).Interface(), nil
|
||||
|
Reference in New Issue
Block a user