From: Juergen Spitzmueller Date: Sun, 23 Mar 2014 12:31:21 +0000 (+0100) Subject: Do not allow the manual insertion of a directory (without filename) into the import... X-Git-Tag: 2.2.0alpha1~2048 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=df1dbe28ce8b1a095ec9b9de92a1dc697c015c28;p=features.git Do not allow the manual insertion of a directory (without filename) into the import dialog and thus prevent an assertion. Fixes: #7437 --- diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 4a4ab00f23..22681f104b 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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