prevent overflow
This commit is contained in:
parent
05d364480a
commit
0bb40c5434
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user