Commit 34ab57aa authored by Filippo Carone's avatar Filippo Carone

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

parent 489d57c1
...@@ -101,15 +101,13 @@ public class MediaListPlayerTest ...@@ -101,15 +101,13 @@ public class MediaListPlayerTest
Assert.assertEquals(0, exception.raised); Assert.assertEquals(0, exception.raised);
} }
// @Test @Test
/**
* This test is disabled: see https://trac.videolan.org/vlc/ticket/1524
*/
public void mediaListPlayerPlayNoItemTest() public void mediaListPlayerPlayNoItemTest()
{ {
libvlc_exception_t exception = new libvlc_exception_t(); libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception); LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
libvlc.libvlc_media_list_player_play(mediaListPlayer, exception); libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
Assert.assertEquals(1, exception.raised);
} }
} }
...@@ -40,6 +40,7 @@ get_next_path( libvlc_media_list_player_t * p_mlp ) ...@@ -40,6 +40,7 @@ get_next_path( libvlc_media_list_player_t * p_mlp )
libvlc_media_list_path_t ret; libvlc_media_list_path_t ret;
libvlc_media_list_t * p_parent_of_playing_item; libvlc_media_list_t * p_parent_of_playing_item;
libvlc_media_list_t * p_sublist_of_playing_item; libvlc_media_list_t * p_sublist_of_playing_item;
p_sublist_of_playing_item = libvlc_media_list_sublist_at_path( p_sublist_of_playing_item = libvlc_media_list_sublist_at_path(
p_mlp->p_mlist, p_mlp->p_mlist,
p_mlp->current_playing_item_path ); p_mlp->current_playing_item_path );
...@@ -428,6 +429,12 @@ void libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp, ...@@ -428,6 +429,12 @@ void libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
{ {
libvlc_media_list_path_t path; 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 ); libvlc_media_list_lock( p_mlp->p_mlist );
path = get_next_path( p_mlp ); path = get_next_path( p_mlp );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment