mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 20:19:42 +01: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)
|
initMediaPlayer(message)
|
||||||
|
|
||||||
if (!mediaPlayer!!.isPlaying) {
|
mediaPlayer?.let {
|
||||||
mediaPlayer!!.start()
|
if (!it.isPlaying) {
|
||||||
|
it.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaPlayerHandler = Handler()
|
mediaPlayerHandler = Handler()
|
||||||
@ -995,6 +996,7 @@ class ChatController(args: Bundle) :
|
|||||||
message.isPlayingVoiceMessage = true
|
message.isPlayingVoiceMessage = true
|
||||||
adapter?.update(message)
|
adapter?.update(message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun pausePlayback(message: ChatMessage) {
|
private fun pausePlayback(message: ChatMessage) {
|
||||||
if (mediaPlayer!!.isPlaying) {
|
if (mediaPlayer!!.isPlaying) {
|
||||||
@ -1031,8 +1033,6 @@ class ChatController(args: Bundle) :
|
|||||||
Log.e(TAG, "failed to initialize mediaPlayer", e)
|
Log.e(TAG, "failed to initialize mediaPlayer", e)
|
||||||
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
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