]> git.lyx.org Git - features.git/commitdiff
This commit fixes the crash caused by loading an empty corrupted document.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 24 Aug 2006 08:17:47 +0000 (08:17 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 24 Aug 2006 08:17:47 +0000 (08:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14828 a592a061-630c-0410-9148-cb99ea01b6c8

src/buffer.C
src/frontends/LyXView.C

index f3bb61494eb632ea28b7fc3b3869bee33272c5da..466da5bc83be1b51b9604aa3db2215b72c2e2a15 100644 (file)
@@ -566,14 +566,15 @@ bool Buffer::readFile(string const & filename)
        paragraphs().clear();
        LyXLex lex(0, 0);
        lex.setFile(filename);
-       bool ret = readFile(lex, filename);
+       if (!readFile(lex, filename))
+               return false;
 
        // After we have read a file, we must ensure that the buffer
        // language is set and used in the gui.
        // If you know of a better place to put this, please tell me. (Lgb)
        updateDocLang(params().language);
 
-       return ret;
+       return true;
 }
 
 
index 2abb0deee49dc26ee03ed1db4174b643f6731fd1..57623e8b9be9765408d293d89f83826678d76728 100644 (file)
@@ -162,7 +162,6 @@ bool LyXView::loadLyXFile(string const & filename, bool tolastfiles)
                disconnectBuffer();
 
        bool loaded = work_area_->bufferView().loadLyXFile(filename, tolastfiles);
-       showErrorList("Parse");
 
        updateMenubar();
        updateToolbars();
@@ -171,6 +170,7 @@ bool LyXView::loadLyXFile(string const & filename, bool tolastfiles)
        if (loaded) {
                connectBuffer(*work_area_->bufferView().buffer());
                setLayout(work_area_->bufferView().firstLayout());
+               showErrorList("Parse");
        }
        redrawWorkArea();
        return loaded;