Skip to content

Commit 4422a05

Browse files
committed
fix(server): prevent protocol error by removing null reason
If the opponent violated, the Game used to crash which also crashed the TestClient, leading to confusing results and inconsistent tests. This was because the Game tried to instantiate a PlayerScore with a null reason, which is disallowed and thus produced an exception. So the reason now defaults to an empty string instead.
1 parent 5f0c13c commit 4422a05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugin/src/server/sc/plugin2020/Game.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public PlayerScore getScoreFor(Player player) {
100100
int[] stats = this.gameState.getPlayerStats(player);
101101
int matchPoints = Constants.DRAW_SCORE;
102102
WinCondition winCondition = checkWinCondition();
103-
String reason = null;
103+
String reason = "";
104104
Player opponent = gameState.getOpponent(player);
105105
if(winCondition != null) {
106106
PlayerColor winner = winCondition.getWinner();

0 commit comments

Comments
 (0)