[vlc-devel] commit: check if media_list_player-> media_list is null before locking - fixes #1524 (Filippo Carone )

git version control git at videolan.org
Mon Mar 17 23:19:27 CET 2008


vlc | branch: master | Filippo Carone <littlejohn at videolan.org> | Mon Mar 17 23:19:25 2008 +0100| [34ab57aad3f670855d4b6d6b2812e7997c5beea4]

check if media_list_player->media_list is null before locking - fixes #1524

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=34ab57aad3f670855d4b6d6b2812e7997c5beea4
---

 .../jvlc/internal/MediaListPlayerTest.java         |    6 ++----
 src/control/media_list_player.c                    |    7 +++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java b/bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
index 191a19a..e70211a 100644
--- a/bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
+++ b/bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
@@ -101,15 +101,13 @@ public class MediaListPlayerTest
         Assert.assertEquals(0, exception.raised);
     }
 
-//    @Test
-    /**
-     * This test is disabled: see https://trac.videolan.org/vlc/ticket/1524
-     */
+    @Test
     public void mediaListPlayerPlayNoItemTest()
     {
         libvlc_exception_t exception = new libvlc_exception_t();
         LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
         libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
+        Assert.assertEquals(1, exception.raised);
     }
 
 }
diff --git a/src/control/media_list_player.c b/src/control/media_list_player.c
index 75b467b..a1239f8 100644
--- a/src/control/media_list_player.c
+++ b/src/control/media_list_player.c
@@ -40,6 +40,7 @@ get_next_path( libvlc_media_list_player_t * p_mlp )
     libvlc_media_list_path_t ret;
     libvlc_media_list_t * p_parent_of_playing_item;
     libvlc_media_list_t * p_sublist_of_playing_item;
+
     p_sublist_of_playing_item = libvlc_media_list_sublist_at_path(
                             p_mlp->p_mlist,
                             p_mlp->current_playing_item_path );
@@ -427,6 +428,12 @@ void libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
                                     libvlc_exception_t * p_e )
 {    
     libvlc_media_list_path_t path;
+
+    if (! p_mlp->p_mlist )
+    {
+        libvlc_exception_raise( p_e, "No more element to play" );
+        return;
+    }
     
     libvlc_media_list_lock( p_mlp->p_mlist );
 




More information about the vlc-devel mailing list