Skip to content

Commit

Permalink
Handle invalid promoted piece (fairy-stockfish#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianfab committed Mar 1, 2024
1 parent bbe0d95 commit 62577a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Position& Position::set(const Variant* v, const string& fenStr, bool isChess960,
}

// Promoted shogi pieces
else if (token == '+' && (idx = piece_to_char().find(ss.peek())) != string::npos)
else if (token == '+' && (idx = piece_to_char().find(ss.peek())) != string::npos && promoted_piece_type(type_of(Piece(idx))))
{
ss >> token;
put_piece(make_piece(color_of(Piece(idx)), promoted_piece_type(type_of(Piece(idx)))), sq, true, Piece(idx));
Expand Down

0 comments on commit 62577a4

Please sign in to comment.