[Android] Fix array size

Geoffrey Métais git at videolan.org
Thu Apr 20 15:39:28 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 20 11:02:01 2017 +0200| [6b746e0a7f52a69cbc98d8df21d76b0c61b1b278] | committer: Geoffrey Métais

Fix array size

> https://code.videolan.org/videolan/vlc-android/commit/6b746e0a7f52a69cbc98d8df21d76b0c61b1b278
---

 medialibrary/jni/utils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index b703d39..c4e54a9 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -260,7 +260,7 @@ filteredArray(JNIEnv* env, fields *fields, jobjectArray array, int removalCount)
         return array;
     if (size == -1)
         size = env->GetArrayLength(array);
-    jobjectArray mediaRefs = (jobjectArray) env->NewObjectArray(size, fields->MediaWrapper.clazz, NULL);
+    jobjectArray mediaRefs = (jobjectArray) env->NewObjectArray(size-removalCount, fields->MediaWrapper.clazz, NULL);
     for (int i = 0; i<size; ++i)
     {
         jobject item = env->GetObjectArrayElement(array, i);



More information about the Android mailing list