diff --git a/slices/slices.go b/slices/slices.go index 7fa4bdf..08dcfa1 100644 --- a/slices/slices.go +++ b/slices/slices.go @@ -39,9 +39,14 @@ func (ps *PtrSlice) Val() interface{} { return ps.current } -func (ps *PtrSlice) Incr() { - ps.idx++ - ps.current = ps.slice.Index(ps.idx).Interface() +func (ps *PtrSlice) Next() { + if ps.idx < ps.length-1 { + ps.idx++ + ps.current = ps.slice.Index(ps.idx).Interface() + } else if ps.idx == ps.length-1 { + ps.idx++ + ps.current = nil + } } func (ps *PtrSlice) Len() int {