]> git.lyx.org Git - lyx.git/commitdiff
Prevent two more assertions due to non-absolute filename as a parameter of file-inser...
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 12 May 2009 00:15:16 +0000 (00:15 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 12 May 2009 00:15:16 +0000 (00:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29638 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp
src/insets/InsetTabular.cpp

index c8b97ed79d18dc4d895cb3e3aeee46531beb4d6d..89793b6b1ff4b18661e2711bd1e1b4b0a98f7643 100644 (file)
@@ -1742,7 +1742,7 @@ void GuiView::insertPlaintextFile(docstring const & fname,
        bool asParagraph)
 {
        BufferView * bv = view();
-       if (!bv)
+       if (!bv || !FileName::isAbsolute(to_utf8(fname)))
                return;
 
        // FIXME UNICODE
index 39ecb09d923d68ec1cf87e3ce30b28e66019e2f6..3b60743e04a1d2d854921d3a464bcf4c7c28de21 100644 (file)
@@ -3605,23 +3605,24 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        // insert file functions
        case LFUN_FILE_INSERT_PLAINTEXT_PARA:
-       case LFUN_FILE_INSERT_PLAINTEXT: {
+       case LFUN_FILE_INSERT_PLAINTEXT:
                // FIXME UNICODE
-               docstring const tmpstr = cur.bv().contentsOfPlaintextFile(
-                       FileName(to_utf8(cmd.argument())));
-               if (tmpstr.empty())
-                       break;
-               cur.recordUndoInset(INSERT_UNDO);
-               if (insertPlaintextString(cur.bv(), tmpstr, false)) {
-                       // content has been replaced,
-                       // so cursor might be invalid
-                       cur.pos() = cur.lastpos();
-                       cur.pit() = cur.lastpit();
-                       bvcur.setCursor(cur);
-               } else
-                       cur.undispatched();
+               if (FileName::isAbsolute(to_utf8(cmd.argument()))) {
+                       docstring const tmpstr = cur.bv().contentsOfPlaintextFile(
+                               FileName(to_utf8(cmd.argument())));
+                       if (tmpstr.empty())
+                               break;
+                       cur.recordUndoInset(INSERT_UNDO);
+                       if (insertPlaintextString(cur.bv(), tmpstr, false)) {
+                               // content has been replaced,
+                               // so cursor might be invalid
+                               cur.pos() = cur.lastpos();
+                               cur.pit() = cur.lastpit();
+                               bvcur.setCursor(cur);
+                       } else
+                               cur.undispatched();
+               }
                break;
-       }
 
        case LFUN_CUT:
                if (cur.selIsMultiCell()) {