diff options
author | Nick White <git@njw.name> | 2022-11-17 12:58:24 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2022-11-17 12:58:24 +0000 |
commit | 4a5ec4f03cf1061658648af5e3bfbe50c14f693b (patch) | |
tree | 20102ca5bee5d5045c030e393a48f10b4d7ec3cf | |
parent | 2e923f2991d4070d86bd5d63a5434f30ce570fd3 (diff) |
-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] } |