]> 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>
Fri, 18 Apr 2014 14:52:47 +0000 (10:52 -0400)
Fixes: #7437(cherry picked from commit afd897029917a083fbeb84cccd4e6cb0a21db7ed)
src/frontends/qt4/GuiView.cpp
status.21x

index 28c6f3a40f0576cba188fbf03498ab54882d0a6c..ae50045962760710722d68064fe89b415a5f7297 100644 (file)
@@ -2119,6 +2119,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
index cb44e134c8ec96d8efeb70e8ace609c7ed4e8126..ed6bd9555fece2b4902f57dc1f7905896162cf1e 100644 (file)
@@ -65,6 +65,8 @@ What's new
 
 - Fix crash when CheckTeX hits mathed (bug 8798).
 
+- Fix assertion when entering a path into the import dialog (bug 7437).
+
 - Failed instant preview compilation now returns an error. And a red box is 
   drawn around very small preview imagines, so they can be seen (bug 7522).