From 5011cfed8c2b379f8790543e6041f7325864e78d Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Sun, 15 Mar 2020 14:27:34 -0500 Subject: [PATCH] fix a null reference when checking for legal en passant moves --- js/chess.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/chess.js b/js/chess.js index 7381e77..9f9972d 100644 --- a/js/chess.js +++ b/js/chess.js @@ -228,7 +228,7 @@ function legalMoves(board, side, type, from, canCapture){ if (there) { if (boardGet(board, there, otherSide(side)) !== ' ') { legals.push(there); - } else { + } else if (forward2) { let otherBoard = board; while (otherBoard && otherBoard.move && otherBoard.move.side[0] === side[0]) { otherBoard = otherBoard.prior;