Qt4 - when cancel was pressed in the open directory dialog, an empty directory
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 22 May 2007 21:41:01 +0000 (21:41 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 22 May 2007 21:41:01 +0000 (21:41 +0000)
string was being added to the playlist, which resulted in an error. Patch  by Nick Vercammen.

modules/gui/qt4/dialogs_provider.cpp

index a2c78a1..7d10899 100644 (file)
@@ -343,12 +343,16 @@ static void openDirectory( intf_thread_t* p_intf, bool pl, bool go )
 {
     QString dir = QFileDialog::getExistingDirectory ( 0,
                                                      _("Open directory") );
-    input_item_t *p_input = input_ItemNewExt( THEPL, qtu(dir), NULL,
+
+    if (!dir.isEmpty()) {
+        input_item_t *p_input = input_ItemNewExt( THEPL, qtu(dir), NULL,
                                                0, NULL, -1 );
-    playlist_AddInput( THEPL, p_input,
+       
+        playlist_AddInput( THEPL, p_input,
                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
                        PLAYLIST_END, pl, VLC_FALSE );
-    input_Read( THEPL, p_input, VLC_FALSE );
+        input_Read( THEPL, p_input, VLC_FALSE );
+    }
 }
 
 void DialogsProvider::PLAppendDir()