Commit 206a6d2e authored by Yoann Peronneau's avatar Yoann Peronneau

* playlist/xspf.c: handles empty nodes

parent 9d179404
...@@ -122,11 +122,17 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file, ...@@ -122,11 +122,17 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
return; return;
} }
/* don't write empty nodes */
if( p_item->i_children == 0 )
{
return;
}
/* leaves can be written directly */ /* leaves can be written directly */
fprintf( p_file, "\t\t<track>\n" ); fprintf( p_file, "\t\t<track>\n" );
/* print identifier and increase the counter */ /* print identifier and increase the counter */
fprintf( p_file, "\t\t\t<identifier>%d</identifier>\n", *p_i_count ); fprintf( p_file, "\t\t\t<identifier>%i</identifier>\n", *p_i_count );
( *p_i_count )++; ( *p_i_count )++;
/* -> the location */ /* -> the location */
...@@ -226,13 +232,14 @@ static void xspf_extension_item( playlist_item_t *p_item, FILE *p_file, ...@@ -226,13 +232,14 @@ static void xspf_extension_item( playlist_item_t *p_item, FILE *p_file,
if( !p_item ) return; if( !p_item ) return;
/* if we get a node here, we must traverse it */ /* if we get a node here, we must traverse it */
if( p_item->i_children > 0 ) if( p_item->i_children >= 0 )
{ {
int i; int i;
char *psz_temp;
fprintf( p_file, "\t\t<node>\n" ); psz_temp = convert_xml_special_chars( p_item->p_input->psz_name );
fprintf( p_file, "\t\t\t<title>%s</title>\n", fprintf( p_file, "\t\t<node title=\"%s\">\n",
p_item->p_input->psz_name ); *psz_temp ? p_item->p_input->psz_name : "" );
free( psz_temp );
for( i = 0; i < p_item->i_children; i++ ) for( i = 0; i < p_item->i_children; i++ )
{ {
...@@ -245,7 +252,7 @@ static void xspf_extension_item( playlist_item_t *p_item, FILE *p_file, ...@@ -245,7 +252,7 @@ static void xspf_extension_item( playlist_item_t *p_item, FILE *p_file,
/* print leaf and increase the counter */ /* print leaf and increase the counter */
fprintf( p_file, "\t\t\t<item href=\"%d\" />\n", *p_i_count ); fprintf( p_file, "\t\t\t<item href=\"%i\" />\n", *p_i_count );
( *p_i_count )++; ( *p_i_count )++;
return; return;
......
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