sumimakito / AwesomeQRCode

An awesome QR code generator for Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error divide by zero with some background image

martialDevOrange opened this issue · comments

Hi,

with some drawable as background image, i have an error divide by zero :
System.err: java.lang.ArithmeticException: divide by zero System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.getDominantColor(AwesomeQRCode.java:377) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.render(AwesomeQRCode.java:116) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.create(AwesomeQRCode.java:92) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.access$700(AwesomeQRCode.java:22) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode$Renderer$1.run(AwesomeQRCode.java:526)

I think the issue may be caused by a background image with no pixels satisfying the statement r<200 && g<200 && b<200, which is used for computing the dominant color without involving too much "light" colors since the foreground and background color of a QR code should not be quite similar.

Anyway, the issue was fixed in commit cef3844.

Cheers 🍻