From e7933b56614eda1941811bb95e533fceb1eaf907 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Thu, 8 Dec 2016 14:52:26 +0000 Subject: [PATCH] Fix problem with null selectedSquare --- app/components/chess-board-square.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/components/chess-board-square.js b/app/components/chess-board-square.js index 3279f1b..25c254e 100644 --- a/app/components/chess-board-square.js +++ b/app/components/chess-board-square.js @@ -28,8 +28,13 @@ class ChessBoardSquare extends React.Component { isSelectedSquare() { var { store } = this.props; - return this.squareCoords().rank == store.getState().selectedSquare.rank - && this.squareCoords().file == store.getState().selectedSquare.file; + if (store.getState().selectedSquare == null) { + return false; + } + else { + return this.squareCoords().rank == store.getState().selectedSquare.rank + && this.squareCoords().file == store.getState().selectedSquare.file; + } } render() {