Skip to content

Commit 48a5cdb

Browse files
author
Xerus
committed
fix(player): send null if no move is possible instead of throwing
1 parent a4deb33 commit 48a5cdb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

player/src/sc/player2020/logic/Logic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void onRequestAction() {
5050
long startTime = System.currentTimeMillis();
5151
log.info("Es wurde ein Zug angefordert.");
5252
List<Move> possibleMoves = GameRuleLogic.getPossibleMoves(gameState);
53-
sendAction(possibleMoves.get((int) (Math.random() * possibleMoves.size())));
53+
sendAction(possibleMoves.isEmpty() ? null : possibleMoves.get((int) (Math.random() * possibleMoves.size())));
5454
}
5555

5656
/**

0 commit comments

Comments
 (0)