[Android] jni: error checking for libvlc_media_list_add_media()

Edward Wang git at videolan.org
Tue Aug 28 23:29:03 CEST 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Aug 28 17:28:52 2012 -0400| [60c382ef9124bb46d77295ed724e0771f5292f37] | committer: Edward Wang

jni: error checking for libvlc_media_list_add_media()

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

 vlc-android/jni/libvlcjni.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index bb0a664..2fb23db 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -623,7 +623,12 @@ void Java_org_videolan_vlc_LibVLC_readMedia(JNIEnv *env, jobject thiz,
     libvlc_media_list_t* p_mlist = getMediaList(env, thiz);
 
     libvlc_media_list_lock(p_mlist);
-    libvlc_media_list_add_media(p_mlist, m);
+    if(libvlc_media_list_add_media(p_mlist, m) != 0) {
+        LOGE("readMedia: Could not add to the media list!");
+        libvlc_media_list_unlock(p_mlist);
+        libvlc_media_release(m);
+        return;
+    }
     int position = libvlc_media_list_index_of_item(p_mlist, m);
     libvlc_media_list_unlock(p_mlist);
 



More information about the Android mailing list