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
This commit is contained in:
Abdelrazak Younes 2006-08-24 08:17:47 +00:00
parent 1451d739c4
commit cd8b0e563c
2 changed files with 4 additions and 3 deletions

View 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;
}

View 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;