From 3e2be025b3b107da0ffc36ec6fc64529228f93dc Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Sat, 2 Apr 2022 17:33:52 +0200 Subject: [PATCH] added support for zero-sized buffers --- buffer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buffer.go b/buffer.go index 80fe593..5c62467 100644 --- a/buffer.go +++ b/buffer.go @@ -102,8 +102,8 @@ func (b *Buffer[T]) Sub(x, y, w, h int) *Buffer[T] { // sanitize inputs x = limit(x, 0, b.width-1) y = limit(y, 0, b.height-1) - w = limit(w, 1, b.width-x) - h = limit(h, 1, b.height-y) + w = limit(w, 0, b.width-x) + h = limit(h, 0, b.height-y) // make slice references data := make([][]T, h)