From 0c56aa9c1323028c5b5c55e9390b263a2dca86cc Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 16 Jan 2021 13:37:40 -0500 Subject: [PATCH] Protect against too small numbers --- commands/games-sp/minesweeper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/games-sp/minesweeper.js b/commands/games-sp/minesweeper.js index d6892a0b..5397ccbd 100644 --- a/commands/games-sp/minesweeper.js +++ b/commands/games-sp/minesweeper.js @@ -48,7 +48,7 @@ module.exports = class MinesweeperCommand extends Command { if (!coordPicked) return false; const x = Number.parseInt(coordPicked[1], 10); const y = Number.parseInt(coordPicked[2], 10); - if (x > size || y > size) return false; + if (x > size || y > size || x < 1 || y < 1) return false; if (game.mask[y - 1][x - 1]) return false; return true; };