fix: verify blur radius to not be less then 1

This commit is contained in:
esimov 2021-11-05 18:14:57 +02:00
parent ed8994c22a
commit 1627bd9ab9

View File

@ -69,6 +69,9 @@ func (c *Carver) StackBlur(img *image.NRGBA, radius uint32) *image.NRGBA {
if int(radius) >= len(mulTable) { if int(radius) >= len(mulTable) {
radius = uint32(len(mulTable) - 1) radius = uint32(len(mulTable) - 1)
} }
if radius < 1 {
radius = 1
}
div = radius + radius + 1 div = radius + radius + 1
widthMinus1 = width - 1 widthMinus1 = width - 1