mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
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:
parent
4e2d14a363
commit
b3c5c1ca89
@ -225,7 +225,7 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
|||||||
cur.clearSelection(); // bug 393
|
cur.clearSelection(); // bug 393
|
||||||
cur.finishUndo();
|
cur.finishUndo();
|
||||||
InsetText * insetText = dynamic_cast<InsetText *>(inset);
|
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
|
// reset first par to default
|
||||||
cur.text()->paragraphs().begin()
|
cur.text()->paragraphs().begin()
|
||||||
->setPlainOrDefaultLayout(bparams.documentClass());
|
->setPlainOrDefaultLayout(bparams.documentClass());
|
||||||
@ -238,9 +238,10 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
|||||||
} else {
|
} else {
|
||||||
cur.leaveInset(*inset);
|
cur.leaveInset(*inset);
|
||||||
// reset surrounding par to default
|
// reset surrounding par to default
|
||||||
docstring const layoutname = insetText->usePlainLayout()
|
DocumentClass const & dc = bparams.documentClass();
|
||||||
? bparams.documentClass().plainLayoutName()
|
docstring const layoutname = inset->usePlainLayout()
|
||||||
: bparams.documentClass().defaultLayoutName();
|
? dc.plainLayoutName()
|
||||||
|
: dc.defaultLayoutName();
|
||||||
text->setLayout(cur, layoutname);
|
text->setLayout(cur, layoutname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user