[Android] Prevent IndexOutOfBoundsException
Geoffrey Métais
git at videolan.org
Tue Jul 4 16:43:21 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jul 4 11:08:25 2017 +0200| [4eb0b5c6a2b0832bd529142f473cb5f76e1efcec] | committer: Geoffrey Métais
Prevent IndexOutOfBoundsException
> https://code.videolan.org/videolan/vlc-android/commit/4eb0b5c6a2b0832bd529142f473cb5f76e1efcec
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 6ac3e5d75..f72330239 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1590,9 +1590,11 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
mSavedTime = mSettings.getLong(audio ? "position_in_song" : "position_in_media", -1);
}
if (!audio) {
- boolean paused = mSettings.getBoolean(PreferencesActivity.VIDEO_PAUSED, !isPlaying());
- if (paused)
- playList.get(position).addFlags(MediaWrapper.MEDIA_PAUSED);
+ if (position < playList.size()) {
+ boolean paused = mSettings.getBoolean(PreferencesActivity.VIDEO_PAUSED, false);
+ if (paused)
+ playList.get(position).addFlags(MediaWrapper.MEDIA_PAUSED);
+ }
float rate = mSettings.getFloat(PreferencesActivity.VIDEO_SPEED, getRate());
if (rate != 1.0f)
setRate(rate, false);
More information about the Android
mailing list