diff options
-rw-r--r-- | integral.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/integral.go b/integral.go index e3d09bb..99a4da7 100644 --- a/integral.go +++ b/integral.go @@ -176,6 +176,9 @@ func (i Image) bottomRight(r image.Rectangle) uint64 { b := i.Bounds() x := lowest(r.Max.X-1, b.Max.X-1) y := lowest(r.Max.Y-1, b.Max.Y-1) + if x < 0 || y < 0 { + return 0 + } return i[y][x] } |