mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
PreviewMediaFragment: prevent NPE on onSaveInstanceState
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
17ebc23621
commit
528705a31d
1 changed files with 2 additions and 2 deletions
|
@ -284,12 +284,12 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|||
outState.putParcelable(EXTRA_FILE, getFile());
|
||||
outState.putParcelable(EXTRA_USER, user);
|
||||
|
||||
if (MimeTypeUtil.isVideo(getFile())) {
|
||||
if (MimeTypeUtil.isVideo(getFile()) && exoPlayer != null) {
|
||||
savedPlaybackPosition = exoPlayer.getCurrentPosition();
|
||||
autoplay = exoPlayer.isPlaying();
|
||||
outState.putLong(EXTRA_PLAY_POSITION, savedPlaybackPosition);
|
||||
outState.putBoolean(EXTRA_PLAYING, autoplay);
|
||||
} else if (mediaPlayerServiceConnection.isConnected()) {
|
||||
} else if (mediaPlayerServiceConnection != null && mediaPlayerServiceConnection.isConnected()) {
|
||||
outState.putInt(EXTRA_PLAY_POSITION, mediaPlayerServiceConnection.getCurrentPosition());
|
||||
outState.putBoolean(EXTRA_PLAYING, mediaPlayerServiceConnection.isPlaying());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue