mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix crash when layout file cannot be read due to failure to call makeTextClass() in that case.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20153 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ec29fd3461
commit
411b7abcfa
@ -531,8 +531,9 @@ bool Buffer::readDocument(Lexer & lex)
|
|||||||
BOOST_ASSERT(paragraphs().empty());
|
BOOST_ASSERT(paragraphs().empty());
|
||||||
|
|
||||||
readHeader(lex);
|
readHeader(lex);
|
||||||
if (!params().getTextClass().load(filePath())) {
|
TextClass const & baseClass = textclasslist[params().getBaseClass()];
|
||||||
string theclass = params().getTextClass().name();
|
if (!baseClass.load(filePath())) {
|
||||||
|
string theclass = baseClass.name();
|
||||||
Alert::error(_("Can't load document class"), bformat(
|
Alert::error(_("Can't load document class"), bformat(
|
||||||
_("Using the default document class, because the "
|
_("Using the default document class, because the "
|
||||||
"class %1$s could not be loaded."), from_utf8(theclass)));
|
"class %1$s could not be loaded."), from_utf8(theclass)));
|
||||||
|
@ -1227,17 +1227,18 @@ void BufferParams::setTextClass(TextClass_ptr tc) {
|
|||||||
|
|
||||||
bool BufferParams::setBaseClass(textclass_type tc)
|
bool BufferParams::setBaseClass(textclass_type tc)
|
||||||
{
|
{
|
||||||
if (!textclasslist[tc].load()) {
|
bool retVal = true;
|
||||||
docstring s = bformat(_("The document class %1$s."
|
if (textclasslist[tc].load())
|
||||||
"could not be loaded."),
|
baseClass_ = tc;
|
||||||
|
else {
|
||||||
|
docstring s =
|
||||||
|
bformat(_("The document class %1$s could not be loaded."),
|
||||||
from_utf8(textclasslist[tc].name()));
|
from_utf8(textclasslist[tc].name()));
|
||||||
frontend::Alert::error(_("Could not load class"), s);
|
frontend::Alert::error(_("Could not load class"), s);
|
||||||
return false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
baseClass_ = tc;
|
|
||||||
makeTextClass();
|
makeTextClass();
|
||||||
return true;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user