1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-04 09:11:33 +02:00

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

* modules/gui/ncurses.c: fix a segfault when playlist is empty
This commit is contained in:
Yoann Peronneau 2005-01-14 18:01:36 +00:00
parent 0eee762179
commit 8313b721e3
2 changed files with 9 additions and 4 deletions

View File

@ -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 */

View File

@ -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++ )
{