Merge pull request #10163 from nextcloud/fix/previewmedia-exoplayer-null

PreviewMediaFragment: prevent crash due to onStop called before exoplayer initialization
This commit is contained in:
Tobias Kaminsky 2022-05-05 15:28:03 +02:00 committed by GitHub
commit d374d87c24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -601,7 +601,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
final OCFile file = getFile();
if (MimeTypeUtil.isAudio(file) && !mediaPlayerServiceConnection.isPlaying()) {
stopAudio();
} else if (MimeTypeUtil.isVideo(file) && exoPlayer.isPlaying()) {
} else if (MimeTypeUtil.isVideo(file) && exoPlayer != null && exoPlayer.isPlaying()) {
savedPlaybackPosition = exoPlayer.getCurrentPosition();
exoPlayer.pause();
}