diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/io/MediaPlayerManager.kt b/app/src/main/java/com/nextcloud/talk/chat/data/io/MediaPlayerManager.kt
index 221b5228a..d08bb2c08 100644
--- a/app/src/main/java/com/nextcloud/talk/chat/data/io/MediaPlayerManager.kt
+++ b/app/src/main/java/com/nextcloud/talk/chat/data/io/MediaPlayerManager.kt
@@ -183,19 +183,26 @@ class MediaPlayerManager : LifecycleAwareManager {
continue
}
- if (mediaPlayer != null && mediaPlayer?.isPlaying == true) {
- val pos = mediaPlayer!!.currentPosition
+ mediaPlayer?.let { player ->
+ try {
+ if (!player.isPlaying) return@let
+ } catch (e: IllegalStateException) {
+ Log.e(TAG, "Seekbar updated during an improper state: $e")
+ return@let
+ }
+
+ val pos = player.currentPosition
mediaPlayerPosition = pos
val progress = (pos.toFloat() / mediaPlayerDuration) * DIVIDER
val progressI = ceil(progress).toInt()
val seconds = (pos / ONE_SEC)
_mediaPlayerSeekBarPosition.emit(progressI)
- currentCycledMessage?.let {
- it.isPlayingVoiceMessage = true
- it.voiceMessageSeekbarProgress = progressI
- it.voiceMessagePlayedSeconds = seconds
- if (progressI >= IS_PLAYED_CUTOFF) it.wasPlayedVoiceMessage = true
- _mediaPlayerSeekBarPositionMsg.emit(it)
+ currentCycledMessage?.let { msg ->
+ msg.isPlayingVoiceMessage = true
+ msg.voiceMessageSeekbarProgress = progressI
+ msg.voiceMessagePlayedSeconds = seconds
+ if (progressI >= IS_PLAYED_CUTOFF) msg.wasPlayedVoiceMessage = true
+ _mediaPlayerSeekBarPositionMsg.emit(msg)
}
}
diff --git a/scripts/analysis/lint-results.txt b/scripts/analysis/lint-results.txt
index 5e5772063..23ae69a91 100644
--- a/scripts/analysis/lint-results.txt
+++ b/scripts/analysis/lint-results.txt
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
- Lint Report: 10 errors and 99 warnings
+ Lint Report: 10 errors and 100 warnings