mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-08 23:19:55 +00:00
Merge pull request #2771 from nextcloud/bugfix/noid/fixNpeVoiceMessagePlayback
avoid NPE for voice message playback
This commit is contained in:
commit
989e3fe211
@ -975,8 +975,9 @@ class ChatController(args: Bundle) :
|
||||
|
||||
initMediaPlayer(message)
|
||||
|
||||
if (!mediaPlayer!!.isPlaying) {
|
||||
mediaPlayer!!.start()
|
||||
mediaPlayer?.let {
|
||||
if (!it.isPlaying) {
|
||||
it.start()
|
||||
}
|
||||
|
||||
mediaPlayerHandler = Handler()
|
||||
@ -995,6 +996,7 @@ class ChatController(args: Bundle) :
|
||||
message.isPlayingVoiceMessage = true
|
||||
adapter?.update(message)
|
||||
}
|
||||
}
|
||||
|
||||
private fun pausePlayback(message: ChatMessage) {
|
||||
if (mediaPlayer!!.isPlaying) {
|
||||
@ -1031,8 +1033,6 @@ class ChatController(args: Bundle) :
|
||||
Log.e(TAG, "failed to initialize mediaPlayer", e)
|
||||
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "mediaPlayer was not null. This should not happen!")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user