Commit 8313b721 authored by Yoann Peronneau's avatar Yoann Peronneau

* modules/access/directory.c: fix a segfault when reading an empty directory

* modules/gui/ncurses.c: fix a segfault when playlist is empty
parent 0eee7621
......@@ -411,6 +411,11 @@ static int ReadDir( playlist_t *p_playlist,
msg_Warn( p_playlist, "Failed to read directory" );
return VLC_EGENERIC;
}
else if( i_dir_content <= 0 )
{
/* directory is empty */
return VLC_SUCCESS;
}
p_dir_content = pp_dir_content[0];
/* while we still have entries in the directory */
......
......@@ -1420,9 +1420,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
{
PlaylistRebuild( p_intf );
}
if( p_sys->b_box_plidx_follow &&
( p_sys->pp_plist[p_sys->i_box_plidx]->p_item !=
p_sys->p_playlist->status.p_item ) )
if( p_sys->b_box_plidx_follow )
{
FindIndex( p_intf );
}
......@@ -1645,7 +1643,9 @@ static void FindIndex( intf_thread_t *p_intf )
{
p_sys->i_box_plidx = p_sys->p_playlist->i_index;
}
else
else if( ( p_sys->i_box_plidx < p_sys->i_plist_entries &&
p_sys->pp_plist[p_sys->i_box_plidx]->p_item !=
p_sys->p_playlist->status.p_item ) )
{
for( i = 0; i < p_sys->i_plist_entries; i++ )
{
......
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