avoid a crash on empty documents (bug 4859)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28345 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-02-04 10:46:54 +00:00
parent 9622577c60
commit deac053e36

View File

@ -1298,8 +1298,18 @@ bool Text::read(Buffer const & buf, Lexer & lex,
if (token == "\\begin_body")
continue;
if (token == "\\end_document")
if (token == "\\end_document") {
// avoid a crash on weird documents (bug 4859)
if (pars_.empty()) {
Paragraph par;
par.setInsetOwner(insetPtr);
par.params().depth(depth);
par.setFont(0, Font(inherit_font,
buf.params().language));
pars_.push_back(par);
}
return false;
}
if (token == "\\begin_layout") {
lex.pushToken(token);