diff --git a/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java b/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java index 4ecee7644..30ba2b81c 100644 --- a/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java +++ b/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java @@ -29,6 +29,13 @@ public void setGameInfo(GameInfo gameInfo) { this.gameInfo = gameInfo; } + public BoardHistoryList shallowCopy() { + BoardHistoryList copy = new BoardHistoryList(null); + copy.head = head; + copy.gameInfo = gameInfo; + return copy; + } + /** * Clear history. */ diff --git a/src/main/java/featurecat/lizzie/rules/SGFParser.java b/src/main/java/featurecat/lizzie/rules/SGFParser.java index dbe5e5f16..61853d1db 100644 --- a/src/main/java/featurecat/lizzie/rules/SGFParser.java +++ b/src/main/java/featurecat/lizzie/rules/SGFParser.java @@ -217,7 +217,7 @@ public static void save(Board board, String filename) throws IOException { private static void saveToStream(Board board, Writer writer) throws IOException { // collect game info - BoardHistoryList history = board.getHistory(); + BoardHistoryList history = board.getHistory().shallowCopy(); GameInfo gameInfo = history.getGameInfo(); String playerBlack = gameInfo.getPlayerBlack(); String playerWhite = gameInfo.getPlayerWhite();