fix a null reference when checking for legal en passant moves
This commit is contained in:
parent
c20dda886a
commit
5011cfed8c
|
|
@ -228,7 +228,7 @@ function legalMoves(board, side, type, from, canCapture){
|
||||||
if (there) {
|
if (there) {
|
||||||
if (boardGet(board, there, otherSide(side)) !== ' ') {
|
if (boardGet(board, there, otherSide(side)) !== ' ') {
|
||||||
legals.push(there);
|
legals.push(there);
|
||||||
} else {
|
} else if (forward2) {
|
||||||
let otherBoard = board;
|
let otherBoard = board;
|
||||||
while (otherBoard && otherBoard.move && otherBoard.move.side[0] === side[0]) {
|
while (otherBoard && otherBoard.move && otherBoard.move.side[0] === side[0]) {
|
||||||
otherBoard = otherBoard.prior;
|
otherBoard = otherBoard.prior;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue