Skip to content

Commit 92612a0

Browse files
authored
End replay parsing when end of game detected (#274)
1 parent 38ccdd6 commit 92612a0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

data/src/main/java/com/faforever/commons/replay/body/ReplayBodyTokenizer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public static List<ReplayBodyToken> tokenize(ByteBuffer buffer) {
2222
final int tokenLength = buffer.getShort() - TOKEN_HEADER_LENGTH;
2323

2424
buffer.position(buffer.position() + tokenLength);
25-
tokens.add(new ReplayBodyToken(ReplayBodyToken.TokenId.values()[tokenId], buffer.position()));
25+
ReplayBodyToken token = new ReplayBodyToken(ReplayBodyToken.TokenId.values()[tokenId], buffer.position());
26+
tokens.add(token);
27+
if (token.tokenId() == ReplayBodyToken.TokenId.CMDST_END_GAME) {
28+
break;
29+
}
2630
}
2731

2832
return tokens;

0 commit comments

Comments
 (0)