]> git.lyx.org Git - features.git/commitdiff
Do not allow the manual insertion of a directory (without filename) into the import...
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 23 Mar 2014 12:31:21 +0000 (13:31 +0100)
committerRichard Heck <rgheck@lyx.org>
Mon, 21 Apr 2014 15:51:58 +0000 (11:51 -0400)
Fixes: #7437
src/frontends/qt4/GuiView.cpp

index 4a4ab00f2361dcaac9674041c656c60bc2f26912..22681f104b36a1a95ad316df5270a6ffbc642239 100644 (file)
@@ -2121,6 +2121,18 @@ void GuiView::importDocument(string const & argument)
        // get absolute path of file
        FileName const fullname(support::makeAbsPath(filename));
 
+       // Can happen if the user entered a path into the dialog
+       // (see bug #7437)
+       if (fullname.onlyFileName().empty()) {
+               docstring msg = bformat(_("The file name '%1$s' is invalid!\n"
+                                         "Aborting import."),
+                                       from_utf8(fullname.absFileName()));
+               frontend::Alert::error(_("File name error"), msg);
+               message(_("Canceled."));
+               return;
+       }
+
+
        FileName const lyxfile(support::changeExtension(fullname.absFileName(), ".lyx"));
 
        // Check if the document already is open