Skip to content

Commit 169c9b2

Browse files
author
Florian Renaud
committed
Throw an error if the media player which has completed is not the expected one
1 parent 8a2f28b commit 169c9b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vector/src/main/java/im/vector/app/features/voicebroadcast/listening/VoiceBroadcastPlayerImpl.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
436436
override fun onCompletion(mp: MediaPlayer) {
437437
// Release media player as soon as it completed
438438
mp.release()
439-
currentMediaPlayer = null
439+
if (currentMediaPlayer == mp) {
440+
currentMediaPlayer = null
441+
} else {
442+
error("The media player which has completed mismatches the current media player instance.")
443+
}
440444

441445
// Next media player is already attached to this player and will start playing automatically
442446
if (nextMediaPlayer != null) return

0 commit comments

Comments
 (0)