Prevent index out of range
This commit is contained in:
parent
b5a8fc8e22
commit
0cdae05f68
@ -78,6 +78,10 @@ imageCanvas.addEventListener("click", function(event) {
|
||||
|
||||
const currentPosition = row * numberOfColumns + column;
|
||||
|
||||
if (currentPosition >= numberOfCaps) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedPosition === null) {
|
||||
selectedPosition = currentPosition;
|
||||
const circlePositionX = rowIsEven ? column * capImageSize + halfCapImageSize : column * capImageSize;
|
||||
|
Loading…
Reference in New Issue
Block a user