mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-02 00:17:41 +01:00
Guard against detached fragment in media preview error handlers.
This commit is contained in:
committed by
Alex Hart
parent
5ca17dfe52
commit
833c81a99e
@@ -513,8 +513,9 @@ class MediaPreviewV2Fragment :
|
||||
}
|
||||
|
||||
override fun onMediaNotAvailable() {
|
||||
Toast.makeText(requireContext(), R.string.MediaPreviewActivity_media_no_longer_available, Toast.LENGTH_LONG).show()
|
||||
requireActivity().finish()
|
||||
val context = context ?: return
|
||||
Toast.makeText(context, R.string.MediaPreviewActivity_media_no_longer_available, Toast.LENGTH_LONG).show()
|
||||
activity?.finish()
|
||||
}
|
||||
|
||||
override fun onMediaReady() {
|
||||
@@ -545,8 +546,9 @@ class MediaPreviewV2Fragment :
|
||||
}
|
||||
|
||||
override fun unableToPlayMedia() {
|
||||
Toast.makeText(requireContext(), R.string.MediaPreviewActivity_unable_to_play_media, Toast.LENGTH_LONG).show()
|
||||
requireActivity().finish()
|
||||
val context = context ?: return
|
||||
Toast.makeText(context, R.string.MediaPreviewActivity_unable_to_play_media, Toast.LENGTH_LONG).show()
|
||||
activity?.finish()
|
||||
}
|
||||
|
||||
private fun forward(mediaItem: MediaTable.MediaRecord) {
|
||||
|
||||
Reference in New Issue
Block a user