]> git.sesse.net Git - vlc/commitdiff
Qt4: ensure to give a valid URI to the playlist
authorLudovic Fauvet <etix@videolan.org>
Thu, 13 Oct 2011 12:33:30 +0000 (14:33 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 13 Oct 2011 15:49:08 +0000 (17:49 +0200)
The URI is only given to the core while the original mrl is kept for the
display.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/dialogs_provider.cpp

index 6905c4257a2d915e325a752eff211f177f8f5c33..d28bf311b358960831f323def44c204b10b3c668 100644 (file)
@@ -474,12 +474,17 @@ void DialogsProvider::openUrlDialog()
         QString url = oud->url();
         if( !url.isEmpty() )
         {
-            playlist_Add( THEPL, qtu( url ),
-                          NULL, !oud->shouldEnqueue() ?
-                                  ( PLAYLIST_APPEND | PLAYLIST_GO )
-                                : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
-                          PLAYLIST_END, true, false );
-            RecentsMRL::getInstance( p_intf )->addRecent( url );
+            char *uri = make_URI( qtu( url ), NULL );
+            if( likely( uri != NULL ) )
+            {
+                playlist_Add( THEPL, uri,
+                              NULL, !oud->shouldEnqueue() ?
+                                      ( PLAYLIST_APPEND | PLAYLIST_GO )
+                                    : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
+                              PLAYLIST_END, true, false );
+                RecentsMRL::getInstance( p_intf )->addRecent( url );
+                free( uri );
+            }
         }
     }
     delete oud;
@@ -739,7 +744,12 @@ void DialogsProvider::SDMenuAction( const QString& data )
  **/
 void DialogsProvider::playMRL( const QString &mrl )
 {
-    playlist_Add( THEPL, qtu(mrl), NULL,
+    char *uri = make_URI( qtu( mrl ), NULL );
+    if( unlikely( uri == NULL ) )
+        return;
+
+    playlist_Add( THEPL, uri, NULL,
            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+    free( uri );
 }