[Android] medialibrary: Fix entrypoint result vector initialization

Hugo Beauzée-Luyssen git at videolan.org
Fri Jan 22 06:02:46 UTC 2021


vlc-android | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Jan 21 17:12:15 2021 +0100| [1676daf53c881b673309a9f7d13d1fe6302d9d33] | committer: Hugo Beauzée-Luyssen

medialibrary: Fix entrypoint result vector initialization

The previous syntax was creating a result vector with N default
initialized values, and N actual values coming from the medialibrary's
query.
Fix #1619

> https://code.videolan.org/videolan/vlc-android/commit/1676daf53c881b673309a9f7d13d1fe6302d9d33
---

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

diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index fef3e13e0..43f0027d5 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -148,7 +148,8 @@ entryPoints(JNIEnv* env, jobject thiz)
 {
     AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
     std::vector<medialibrary::FolderPtr> entryPoints = aml->entryPoints();
-    std::vector<std::string> mrls{ entryPoints.size() };
+    std::vector<std::string> mrls;
+    mrls.reserve(entryPoints.size());
     for(medialibrary::FolderPtr& entryPoint : entryPoints) {
         try
         {



More information about the Android mailing list