mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
Fix potential crash if an engine reports an invalid currmove
Could cause an ArrayIndexOutOfBoundsException: at org.petero.droidfish.gamelogic.Position.getPiece (Position.java:153) at org.petero.droidfish.gamelogic.MoveGen.pseudoLegalMoves (MoveGen.java:109) at org.petero.droidfish.gamelogic.MoveGen.legalMoves (MoveGen.java:32) at org.petero.droidfish.gamelogic.TextIO.moveToString (TextIO.java:429) at org.petero.droidfish.gamelogic.TextIO.moveToString (TextIO.java:339) at org.petero.droidfish.gamelogic.DroidChessController$SearchListener.notifyCurrMove (DroidChessController.java:826)
This commit is contained in:
parent
06375cbf1b
commit
8fdfdede44
|
@ -838,8 +838,11 @@ public class DroidChessController {
|
|||
|
||||
@Override
|
||||
public void notifyCurrMove(int id, Position pos, Move m, int moveNr) {
|
||||
Position tmpPos = new Position(pos);
|
||||
if (!TextIO.isValid(tmpPos, m))
|
||||
m = new Move(0, 0, 0);
|
||||
currMove = m;
|
||||
currMoveStr = TextIO.moveToString(pos, m, false, localPt());
|
||||
currMoveStr = TextIO.moveToString(tmpPos, m, false, localPt());
|
||||
currMoveNr = moveNr;
|
||||
setSearchInfo(id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user