]> git.lyx.org Git - features.git/commitdiff
Fix crash noticed by Vincent. We don't know that insetText is non-null here!
authorRichard Heck <rgheck@comcast.net>
Sat, 9 Aug 2008 16:56:30 +0000 (16:56 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 9 Aug 2008 16:56:30 +0000 (16:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26112 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text3.cpp

index 022973376c75f810f7cfb1719a0023614f94aa6c..4b659d4a643b30f60c8703291ee128c7c81526d6 100644 (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);
        }