aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/term/terminal.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/term/terminal.go')
-rw-r--r--vendor/golang.org/x/term/terminal.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/vendor/golang.org/x/term/terminal.go b/vendor/golang.org/x/term/terminal.go
index 535ab8257..4b48a5899 100644
--- a/vendor/golang.org/x/term/terminal.go
+++ b/vendor/golang.org/x/term/terminal.go
@@ -935,7 +935,7 @@ func (s *stRingBuffer) Add(a string) {
// next most recent, and so on. If such an element doesn't exist then ok is
// false.
func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
- if n >= s.size {
+ if n < 0 || n >= s.size {
return "", false
}
index := s.head - n