projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
bbe0d95
)
Handle invalid promoted piece (#416)
author
Fabian Fichter
<ianfab@users.noreply.github.com>
Fri, 1 Mar 2024 14:28:21 +0000 (15:28 +0100)
committer
Fabian Fichter
<ianfab@users.noreply.github.com>
Fri, 1 Mar 2024 14:28:21 +0000 (15:28 +0100)
src/position.cpp
patch
|
blob
|
history
diff --git
a/src/position.cpp
b/src/position.cpp
index
023cdfa
..
ade4798
100644
(file)
--- 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));