another bug in VriantSwitch: an unitialized board was printed.
[xboard.git] / backend.c
index a8a44cb..f1d3eb4 100755 (executable)
--- a/backend.c
+++ b/backend.c
@@ -2016,8 +2016,7 @@ VariantSwitch(Board board, VariantClass newVariant)
    } else gameInfo.variant = newVariant;
    CopyBoard(oldBoard, board);   // remember correctly formatted board
      InitPosition(FALSE);          /* this sets up board[0], but also other stuff        */
-   if(currentMove == 0) CopyBoard(board, oldBoard); // preserve start position
-   DrawPosition(TRUE, boards[currentMove]);
+   DrawPosition(TRUE, currentMove ? boards[currentMove] : oldBoard);
 }
 
 static int loggedOn = FALSE;
@@ -3579,7 +3578,7 @@ ParseBoard12(string)
        timeIncrement = increment * 1000;
        movesPerSession = 0;
        gameInfo.timeControl = TimeControlTagValue();
-        VariantSwitch(board, StringToVariant(gameInfo.event) );
+        VariantSwitch(boards[currentMove], StringToVariant(gameInfo.event) );
   if (appData.debugMode) {
     fprintf(debugFP, "ParseBoard says variant = '%s'\n", gameInfo.event);
     fprintf(debugFP, "recognized as %s\n", VariantName(gameInfo.variant));