From 3bd446705da0b7dbb50aa1ae3d846ae3a62118e7 Mon Sep 17 00:00:00 2001 From: Daisuke Maki Date: Fri, 20 Feb 2026 22:43:56 +0900 Subject: [PATCH] add negative index check to FilteredBuffer.LineAt --- buffer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buffer.go b/buffer.go index 04c2738..4f1671a 100644 --- a/buffer.go +++ b/buffer.go @@ -94,7 +94,7 @@ func (flb *FilteredBuffer) MaxColumn() int { // in this filtered buffer may actually correspond to a totally // different line number in the source buffer. func (flb FilteredBuffer) LineAt(i int) (line.Line, error) { - if i >= len(flb.selection) { + if i < 0 || i >= len(flb.selection) { return nil, fmt.Errorf("specified index %d is out of range", len(flb.selection)) } return flb.src.LineAt(flb.selection[i])