Skip to content

Commit 6f56801

Browse files
committed
fix(network/LobbyClient): prevent ConcurrentModificationExceptions
1 parent 5c6c619 commit 6f56801

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sdk/src/server-api/sc/networking/clients/LobbyClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private void onGameLeft(String roomId) {
103103
}
104104

105105
private void onGameJoined(String roomId) {
106-
for (ILobbyClientListener listener : this.listeners) {
106+
for (ILobbyClientListener listener : new ArrayList<>(this.listeners)) {
107107
listener.onGameJoined(roomId);
108108
}
109109
}
@@ -116,7 +116,7 @@ private void onGameObserved(String roomId) {
116116

117117

118118
protected void onGamePrepared(GamePreparedResponse response) {
119-
for (ILobbyClientListener listener : this.listeners) {
119+
for (ILobbyClientListener listener : new ArrayList<>(this.listeners)) {
120120
listener.onGamePrepared(response);
121121
}
122122
}

0 commit comments

Comments
 (0)