From 518a0dc97d18276d7c0cf946c69ec761b1ed50a5 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sun, 15 Mar 2020 15:49:32 +0100 Subject: [PATCH] Fix bug in Eightpieces rules (division by 0) --- client/src/variants/Eightpieces.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/variants/Eightpieces.js b/client/src/variants/Eightpieces.js index beaddbe9..f7d93d84 100644 --- a/client/src/variants/Eightpieces.js +++ b/client/src/variants/Eightpieces.js @@ -924,7 +924,7 @@ export const VariantRules = class EightpiecesRules extends ChessRules { absDeltaX = Math.abs(deltaX); const deltaY = y2 - y1, absDeltaY = Math.abs(deltaY); - const step = [ deltaX / absDeltaX, deltaY / absDeltaY ]; + const step = [ deltaX / absDeltaX || 0, deltaY / absDeltaY || 0 ]; if ( // Check that the step is a priori valid: (absDeltaX != absDeltaY && deltaX != 0 && deltaY != 0) || -- 2.44.0