diff --git a/buffer.go b/buffer.go index eec10ed..321c7a1 100644 --- a/buffer.go +++ b/buffer.go @@ -42,7 +42,7 @@ func (b *Buffer[T]) y(y int) int { // Set sets the value at position (x,y) to c func (b *Buffer[T]) Set(x, y int, v T) { - if b.width >= 0 && b.height >= 0 { + if b.width > 0 && b.height > 0 { b.data[b.y(y)][b.x(x)] = v } } diff --git a/buffer_test.go b/buffer_test.go index 64e55cf..a159b70 100644 --- a/buffer_test.go +++ b/buffer_test.go @@ -19,6 +19,6 @@ func TestSub(t *testing.T) { } func TestSet(t *testing.T) { - b := NewBuffer(10, 10, ' ') - b.Set(11, 0, 'a') + b := NewBuffer(0, 0, ' ') + b.Set(0, 0, 'a') }