From 34ab57aad3f670855d4b6d6b2812e7997c5beea4 Mon Sep 17 00:00:00 2001 From: Filippo Carone Date: Mon, 17 Mar 2008 23:19:25 +0100 Subject: [PATCH] check if media_list_player->media_list is null before locking - fixes #1524 --- .../org/videolan/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 191a19a9cb..e70211aa04 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 75b467b2cd..a1239f8c29 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 ); -- 2.39.2