Preventing index out of range error if increasing block size

This commit is contained in:
2022-02-24 18:19:56 +01:00
parent 80d97f6307
commit 53a95b1d50
2 changed files with 2 additions and 3 deletions

View File

@ -40,7 +40,6 @@ func genGhIcon(id string, size int, f func([16]byte) color.RGBA) *image.NRGBA {
if size > 512 {
size = 512
}
blocks := 5
hash := hashBytes(id)
@ -52,7 +51,7 @@ func genGhIcon(id string, size int, f func([16]byte) color.RGBA) *image.NRGBA {
ni := x + blocks*(blocks-y-1)
if x+blocks*y > 2*blocks {
di := (x + blocks*y) - 2*blocks
data[di] = nibbles[ni]%2 == 0
data[di] = nibbles[ni%32]%2 == 0
}
}
}