From 2c88e6ab2f61e1b73cda66e93ccd59c0d9c0af64 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 23 Mar 2014 13:31:21 +0100 Subject: [PATCH] Do not allow the manual insertion of a directory (without filename) into the import dialog and thus prevent an assertion. Fixes: #7437(cherry picked from commit afd897029917a083fbeb84cccd4e6cb0a21db7ed) --- src/frontends/qt4/GuiView.cpp | 12 ++++++++++++ status.20x | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 095c4275fb..2398899bb5 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2108,6 +2108,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 diff --git a/status.20x b/status.20x index 52dab75fe3..c6328bd215 100644 --- a/status.20x +++ b/status.20x @@ -98,6 +98,8 @@ What's new - Fix hang when selecting text (bug 8837). +- Fix assertion when entering a path into the import dialog (bug 7437). + - Fix math-ams-matrix function that could corrupt documents if not used properly (part of bug 8359).