Fix crash noticed by Vincent. We don't know that insetText is non-null here!

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-08-09 16:56:30 +00:00
parent 4e2d14a363
commit b3c5c1ca89

View File

@ -225,7 +225,7 @@ static bool doInsertInset(Cursor & cur, Text * text,
cur.clearSelection(); // bug 393
cur.finishUndo();
InsetText * insetText = dynamic_cast<InsetText *>(inset);
if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) {
if (insetText && (!insetText->allowMultiPar() || cur.lastpit() == 0)) {
// reset first par to default
cur.text()->paragraphs().begin()
->setPlainOrDefaultLayout(bparams.documentClass());
@ -238,9 +238,10 @@ static bool doInsertInset(Cursor & cur, Text * text,
} else {
cur.leaveInset(*inset);
// reset surrounding par to default
docstring const layoutname = insetText->usePlainLayout()
? bparams.documentClass().plainLayoutName()
: bparams.documentClass().defaultLayoutName();
DocumentClass const & dc = bparams.documentClass();
docstring const layoutname = inset->usePlainLayout()
? dc.plainLayoutName()
: dc.defaultLayoutName();
text->setLayout(cur, layoutname);
}