diff --git a/Public/grid.js b/Public/grid.js index bc4ceda..7a6c903 100644 --- a/Public/grid.js +++ b/Public/grid.js @@ -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;