Skip to content

Commit

Permalink
don't allow message jump that is > len(body)
Browse files Browse the repository at this point in the history
  • Loading branch information
cswank committed Oct 9, 2019
1 parent bd9997d commit 226d953
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/views/feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,14 @@ func (m *message) search(s string, cb func(int64, int64)) (int64, error) {
}

func (m *message) jump(i int64) error {
m.pg = int(i) / m.height
m.offset = int(i) % m.height
pg := int(i) / m.height
o := int(i) % m.height
if (pg*m.height)+o > len(m.body) {
return nil
}

m.pg = pg
m.offset = o
return nil
}

Expand Down

0 comments on commit 226d953

Please sign in to comment.