From c16507607c69839f7ccba309a8f559aed98e017e Mon Sep 17 00:00:00 2001 From: astaxie Date: Thu, 15 Sep 2016 11:11:34 +0800 Subject: [PATCH] fix #2161 --- utils/captcha/image.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/captcha/image.go b/utils/captcha/image.go index 1057192a..0ceb8e42 100644 --- a/utils/captcha/image.go +++ b/utils/captcha/image.go @@ -359,6 +359,9 @@ func (m *Image) calculateSizes(width, height, ncount int) { } // Calculate dot size. m.dotSize = int(nh / fh) + if m.dotSize < 1 { + m.dotSize = 1 + } // Save everything, making the actual width smaller by 1 dot to account // for spacing between digits. m.numWidth = int(nw) - m.dotSize