Skip to content

Commit

Permalink
Prevent CME when adding players' emotes (GeyserMC#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
Camotoy authored Jan 12, 2021
1 parent fb283fc commit af405f3
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServ

this.inventoryCache.getInventories().put(0, inventory);

connector.getPlayers().forEach(player -> this.emotes.addAll(player.getEmotes()));
// Make a copy to prevent ConcurrentModificationException
final List<GeyserSession> tmpPlayers = new ArrayList<>(connector.getPlayers());
tmpPlayers.forEach(player -> this.emotes.addAll(player.getEmotes()));

bedrockServerSession.addDisconnectHandler(disconnectReason -> {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.disconnect", bedrockServerSession.getAddress().getAddress(), disconnectReason));
Expand Down

0 comments on commit af405f3

Please sign in to comment.