[Android] MediaList: add move sanity check

Edward Wang git at videolan.org
Thu Jan 23 21:05:18 CET 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jan 23 15:05:14 2014 -0500| [41cac95f0b7270bf97bbc32f098957aa233ebeb3] | committer: Edward Wang

MediaList: add move sanity check

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

 vlc-android/src/org/videolan/libvlc/MediaList.java |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/libvlc/MediaList.java b/vlc-android/src/org/videolan/libvlc/MediaList.java
index deef78b..074c733 100644
--- a/vlc-android/src/org/videolan/libvlc/MediaList.java
+++ b/vlc-android/src/org/videolan/libvlc/MediaList.java
@@ -22,7 +22,6 @@ package org.videolan.libvlc;
 
 import java.util.ArrayList;
 
-
 import android.os.Bundle;
 
 /**
@@ -136,6 +135,9 @@ public class MediaList {
     }
 
     public void move(int startPosition, int endPosition) {
+        if(!( isValid(startPosition) && isValid(endPosition) ))
+            throw new IndexOutOfBoundsException("Indexes out of range");
+
         MediaHolder toMove = mInternalList.get(startPosition);
         mInternalList.remove(startPosition);
         if (startPosition >= endPosition)



More information about the Android mailing list