Commit b6198c88 authored by Rafaël Carré's avatar Rafaël Carré

Prevents segfault if no file are in the playlist (thanks j-b)

Adds some debug message and extra check
parent 8329eb01
...@@ -47,6 +47,7 @@ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) : ...@@ -47,6 +47,7 @@ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
{ {
int line = 0; int line = 0;
QGridLayout *l = new QGridLayout( this ); QGridLayout *l = new QGridLayout( this );
p_input = NULL;
#define ADD_META( string, widget ) { \ #define ADD_META( string, widget ) { \
l->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \ l->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \
...@@ -139,6 +140,9 @@ void MetaPanel::saveMeta() ...@@ -139,6 +140,9 @@ void MetaPanel::saveMeta()
meta_export_t p_export; meta_export_t p_export;
p_export.p_item = p_input; p_export.p_item = p_input;
if( p_input == NULL )
return;
/* we can write meta data only in a file */ /* we can write meta data only in a file */
if( ( p_input->i_type == ITEM_TYPE_AFILE ) || \ if( ( p_input->i_type == ITEM_TYPE_AFILE ) || \
( p_input->i_type == ITEM_TYPE_VFILE ) ) ( p_input->i_type == ITEM_TYPE_VFILE ) )
......
...@@ -174,9 +174,16 @@ static int WriteMeta( vlc_object_t *p_this ) ...@@ -174,9 +174,16 @@ static int WriteMeta( vlc_object_t *p_this )
meta_export_t *p_export = (meta_export_t *)p_playlist->p_private; meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
input_item_t *p_item = p_export->p_item; input_item_t *p_item = p_export->p_item;
if( p_item == NULL )
{
msg_Err( p_this, "Can't save meta data of an empty input" );
return VLC_EGENERIC;
}
TagLib::FileRef f( p_export->psz_file ); TagLib::FileRef f( p_export->psz_file );
if( !f.isNull() && f.tag() ) if( !f.isNull() && f.tag() )
{ {
msg_Dbg( p_this, "Updating metadata for %s", p_export->psz_file );
TagLib::Tag *tag = f.tag(); TagLib::Tag *tag = f.tag();
SET( Artist, p_item->p_meta->psz_artist ); SET( Artist, p_item->p_meta->psz_artist );
if( p_item->p_meta->psz_title ) if( p_item->p_meta->psz_title )
......
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