Debug PGN import

This commit is contained in:
Loic Guegan 2022-02-23 18:47:18 +01:00
parent ce941c146a
commit a3c24f27f0
4 changed files with 12 additions and 8 deletions

View file

@ -97,9 +97,13 @@ void MainWindow::OnOpen(wxCommandEvent &event) {
fen = pgn.GetTagValue("FEN");
}
HalfMove *m = new HalfMove(pgnp_moves, fen);
NewGame(new Game(m));
} catch (...) {
SHOW_DIALOG_ERROR("Invalid PGN file");
Game *g=new Game(m,fen);
for(std::string &s:pgn.GetTagList()){
g->SetTag(s,pgn.GetTagValue(s));
}
NewGame(g);
} catch (std::exception &e) {
SHOW_DIALOG_ERROR("Invalid PGN file: " + std::string(e.what()));
}
}
}