]> git.lyx.org Git - features.git/commitdiff
Test Paragraph::inInset() before using it. Fixes bug http://bugzilla.lyx.org/show_bug...
authorAbdelrazak Younes <younes@lyx.org>
Fri, 12 Sep 2008 12:55:35 +0000 (12:55 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 12 Sep 2008 12:55:35 +0000 (12:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26369 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text2.cpp

index 30faefd3f7fc94c7be96492191364ea6a013368f..65c08044c2160156ffdaabadfa3b7b3e77ba8266 100644 (file)
@@ -90,7 +90,8 @@ FontInfo Text::layoutFont(Buffer const & buffer, pit_type const pit) const
                // now, because Inset::getLayout() will return a default-constructed
                // InsetLayout, and that e.g. sets the foreground color to red. So we
                // need to do some work to make that possible.
-               InsetCollapsable const * icp = pars_[pit].inInset()->asInsetCollapsable();
+               Inset const * inset = pars_[pit].inInset();
+               InsetCollapsable const * icp = inset? inset->asInsetCollapsable() : 0;
                if (!icp)
                        return lf;
                FontInfo icf = icp->getLayout().font();
@@ -118,7 +119,8 @@ FontInfo Text::labelFont(Buffer const & buffer, Paragraph const & par) const
                if (layout.labelfont.family() == INHERIT_FAMILY)
                        lf.setFamily(buffer.params().getFont().fontInfo().family());
                // FIXME As above....
-               InsetCollapsable const * icp = par.inInset()->asInsetCollapsable();
+               Inset const * inset = par.inInset();
+               InsetCollapsable const * icp = inset? inset->asInsetCollapsable() : 0;
                if (!icp)
                        return lf;
                FontInfo icf = icp->getLayout().labelfont();