[Android] Fix NPE
Geoffrey Métais
git at videolan.org
Thu Jun 30 10:12:07 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 30 10:10:52 2016 +0200| [5ecbbda7552c2ad9f427eef6c7e1c227b968815e] | committer: Geoffrey Métais
Fix NPE
> https://code.videolan.org/videolan/vlc-android/commit/5ecbbda7552c2ad9f427eef6c7e1c227b968815e
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index a1e8827..60d5616 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2864,8 +2864,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
int positionInPlaylist = -1;
Intent intent = getIntent();
Bundle extras = intent.getExtras();
- long savedTime = extras.getLong(PLAY_EXTRA_START_TIME); // position passed in by intent (ms)
- if (savedTime == 0l)
+ long savedTime = extras != null ? extras.getLong(PLAY_EXTRA_START_TIME) : 0L; // position passed in by intent (ms)
+ if (extras != null && savedTime == 0L)
savedTime = extras.getInt(PLAY_EXTRA_START_TIME);
/*
* If the activity has been paused by pressing the power button, then
@@ -2931,8 +2931,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
// restarting again when playback is paused.
intent.putExtra(PLAY_EXTRA_FROM_START, false);
if (fromStart || mService.isPlaying())
- media.setTime(0l);
- else if (savedTime <= 0)
+ media.setTime(0L);
+ else if (savedTime <= 0L)
savedTime = media.getTime();
mLastAudioTrack = media.getAudioTrack();
@@ -2940,7 +2940,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
} else {
// not in media library
- if (savedTime > 0 && mAskResume) {
+ if (savedTime > 0L && mAskResume) {
showConfirmResumeDialog();
return;
} else {
@@ -2974,7 +2974,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
media.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
media.addFlags(MediaWrapper.MEDIA_VIDEO);
- if (savedTime <= 0 && media != null && media.getTime() > 0l)
+ if (savedTime <= 0L && media != null && media.getTime() > 0L)
savedTime = media.getTime();
if (savedTime > 0L && !mService.isPlaying())
mService.saveTimeToSeek(savedTime);
More information about the Android
mailing list