mirror of
https://github.com/pcvolkmer/idicon.git
synced 2025-07-02 11:52:54 +00:00
Preventing index out of range error if increasing block size
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user