From: Abdelrazak Younes Date: Thu, 24 Aug 2006 08:17:47 +0000 (+0000) Subject: This commit fixes the crash caused by loading an empty corrupted document. X-Git-Tag: 1.6.10~12700 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=cd8b0e563cc0cf53bf2fa7c0bf90fda8806448be;p=features.git This commit fixes the crash caused by loading an empty corrupted document. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14828 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/buffer.C b/src/buffer.C index f3bb61494e..466da5bc83 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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; } diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 2abb0deee4..57623e8b9b 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -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;