From 62577a4039e48c55a579edac78dbdbec5d3bf71e Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 1 Mar 2024 15:28:21 +0100 Subject: [PATCH] Handle invalid promoted piece (#416) --- src/position.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/position.cpp b/src/position.cpp index 023cdfa72..ade4798d1 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -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));