]> git.sesse.net Git - vlc/commitdiff
Prevents segfault if no file are in the playlist (thanks j-b)
authorRafaël Carré <funman@videolan.org>
Sun, 24 Jun 2007 16:07:38 +0000 (16:07 +0000)
committerRafaël Carré <funman@videolan.org>
Sun, 24 Jun 2007 16:07:38 +0000 (16:07 +0000)
Adds some debug message and extra check

modules/gui/qt4/components/infopanels.cpp
modules/meta_engine/taglib.cpp

index 52cda41e5d246cda0fbeed51fb615d749f315931..9ac241161fb03cfba62034b54d4c21a67f2438ad 100644 (file)
@@ -47,6 +47,7 @@ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
 {
     int line = 0;
     QGridLayout *l = new QGridLayout( this );
+    p_input = NULL;
 
 #define ADD_META( string, widget ) {                             \
     l->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \
@@ -139,6 +140,9 @@ void MetaPanel::saveMeta()
     meta_export_t p_export;
     p_export.p_item = p_input;
 
+    if( p_input == NULL )
+        return;
+
     /* we can write meta data only in a file */
     if( ( p_input->i_type == ITEM_TYPE_AFILE ) || \
         ( p_input->i_type == ITEM_TYPE_VFILE ) )
index bb3958aaba17ac9122457513be894cdb838724dd..e317b7ce0243a587378be2425834ceae0183bd28 100644 (file)
@@ -173,10 +173,17 @@ static int WriteMeta( vlc_object_t *p_this )
     playlist_t *p_playlist = (playlist_t *)p_this;
     meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
     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 );
     if( !f.isNull() && f.tag() )
     {
+        msg_Dbg( p_this, "Updating metadata for %s", p_export->psz_file );
         TagLib::Tag *tag = f.tag();
         SET( Artist, p_item->p_meta->psz_artist );
         if( p_item->p_meta->psz_title )