prevent overflow

This commit is contained in:
Diego Fernando Carrión 2021-08-29 20:29:48 +02:00
parent 05d364480a
commit 0bb40c5434

View File

@ -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 {