Skip to content

Commit

Permalink
Null check for file onStop function
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Oct 26, 2023
1 parent 27611c4 commit b87c13c
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,14 @@ public void onDestroyView() {
public void onStop() {
Log_OC.v(TAG, "onStop");
final OCFile file = getFile();
if (MimeTypeUtil.isAudio(file) && !mediaPlayerServiceConnection.isPlaying()) {
stopAudio();
} else if (MimeTypeUtil.isVideo(file) && exoPlayer != null && exoPlayer.isPlaying()) {
savedPlaybackPosition = exoPlayer.getCurrentPosition();
exoPlayer.pause();

if (file != null) {
if (MimeTypeUtil.isAudio(file) && !mediaPlayerServiceConnection.isPlaying()) {
stopAudio();
} else if (MimeTypeUtil.isVideo(file) && exoPlayer != null && exoPlayer.isPlaying()) {
savedPlaybackPosition = exoPlayer.getCurrentPosition();
exoPlayer.pause();
}
}

mediaPlayerServiceConnection.unbind();
Expand Down

0 comments on commit b87c13c

Please sign in to comment.