[Android] Fix ConcurrentModificationException
Nicolas Pomepuy
git at videolan.org
Thu Oct 17 13:38:14 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Oct 17 09:53:26 2024 +0200| [344be73e6e6d34e7f76f438ab3a16baf02b45702] | committer: Duncan McNamara
Fix ConcurrentModificationException
> https://code.videolan.org/videolan/vlc-android/commit/344be73e6e6d34e7f76f438ab3a16baf02b45702
---
.../org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
index 4070a2dd40..72d53670e5 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
@@ -379,7 +379,10 @@ object RemoteAccessWebSockets {
private fun addToQueue(wsMessage: RemoteAccessServer.WSMessage) {
val typesDuplicates = arrayOf("now-playing", "play-queue", "auth", "volume", "player-status", "login-needed", "ml-refresh-needed", "playback-control-forbidden")
if (wsMessage.type in typesDuplicates) {
- messageQueue.removeIf { it.type == wsMessage.type }
+ try {
+ messageQueue.removeIf { it.type == wsMessage.type }
+ } catch (_: ConcurrentModificationException) {
+ }
}
messageQueue.add(wsMessage)
}
More information about the Android
mailing list