Verified Commit c168c3a3 authored by Daniel Sonck's avatar Daniel Sonck
Browse files

Fix Concurrent modification error

parent 46404041
...@@ -45,10 +45,8 @@ import android.support.v4.media.session.MediaControllerCompat ...@@ -45,10 +45,8 @@ import android.support.v4.media.session.MediaControllerCompat
import android.support.v4.media.session.MediaSessionCompat import android.support.v4.media.session.MediaSessionCompat
import android.support.v4.media.session.PlaybackStateCompat import android.support.v4.media.session.PlaybackStateCompat
import android.util.Log import android.util.Log
import fm.touhou.touhoufm.service.MusicService import fm.touhou.touhoufm.service.MusicService
import java.util.*
import java.util.ArrayList
/** /**
* Adapter for a MediaBrowser that handles connecting, disconnecting, * Adapter for a MediaBrowser that handles connecting, disconnecting,
...@@ -132,11 +130,12 @@ class MediaBrowserAdapter(private val mContext: Context) { ...@@ -132,11 +130,12 @@ class MediaBrowserAdapter(private val mContext: Context) {
} }
private fun performOnAllListeners(command: ListenerCommand) { private fun performOnAllListeners(command: ListenerCommand) {
for (listener in mListeners) { val it = mListeners.listIterator()
while(it.hasNext()) {
try { try {
command.perform(listener) command.perform(it.next())
} catch (e: Exception) { } catch (e: Exception) {
removeListener(listener) it.remove()
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment