[Android] audio: fix crash if no more media to play

Sébastien Toque git at videolan.org
Wed Jan 15 20:03:21 CET 2014


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Wed Jan 15 20:02:57 2014 +0100| [55a8834828cdcb65427de368bc7ad08582df1942] | committer: Sébastien Toque

audio: fix crash if no more media to play

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=55a8834828cdcb65427de368bc7ad08582df1942
---

 vlc-android/src/org/videolan/vlc/AudioService.java |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 39db032..704e3e8 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -792,7 +792,7 @@ public class AudioService extends Service {
         mCurrentIndex = mNextIndex;
 
         int size = mLibVLC.getMediaList().size();
-        if (size == 0 || mCurrentIndex >= size) {
+        if (size == 0 || mCurrentIndex < 0 || mCurrentIndex >= size) {
             Log.w(TAG, "Warning: invalid next index, aborted !");
             stop();
             return;
@@ -832,7 +832,7 @@ public class AudioService extends Service {
         mCurrentIndex = mPrevIndex;
 
         int size = mLibVLC.getMediaList().size();
-        if (size == 0 || mCurrentIndex >= size) {
+        if (size == 0 || mPrevIndex < 0 || mCurrentIndex >= size) {
             Log.w(TAG, "Warning: invalid previous index, aborted !");
             stop();
             return;



More information about the Android mailing list