diff libgui/src/set-path-dialog.cc @ 27307:7a7709bfb5af

path dlg: do not add empty dir when dir selection dialog is canceled * set_path_dialog.cc (add_dir): only add the result string from dir selection dialog to the path model if it is not empty
author Torsten Lilge <ttl-octave@mailbox.org>
date Wed, 31 Jul 2019 21:53:59 +0200
parents 82ace1225a9c
children 401a7cda7c9e
line wrap: on
line diff
--- a/libgui/src/set-path-dialog.cc	Wed Jul 31 16:46:02 2019 +0200
+++ b/libgui/src/set-path-dialog.cc	Wed Jul 31 21:53:59 2019 +0200
@@ -163,8 +163,13 @@
                                            "",
                                            (QFileDialog::ShowDirsOnly
                                             | QFileDialog::DontResolveSymlinks));
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    m->add_dir (dir);
+
+    if (! dir.isEmpty ())
+      {
+        set_path_model *m
+            = static_cast<set_path_model *> (m_path_list->model ());
+        m->add_dir (dir);
+      }
   }
 
   void set_path_dialog::rm_dir (void)