Fix check testing in games without King
[xboard.git] / moves.c
diff --git a/moves.c b/moves.c
index 25263c8..2f6a706 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1735,6 +1735,8 @@ CheckTest (Board board, int flags, int rf, int ff, int rt, int ft, int enPassant
        }
     }
 
+    if(PieceToChar(king) == '.') return 0; // never in check if the royal piece does not participate
+
     if (rt >= 0) {
        if (enPassant) {
            captured = board[rf][ft];