From 0743708418059fd7688228451a681ee79ba1db8a Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 12 Sep 2008 12:55:35 +0000 Subject: [PATCH] Test Paragraph::inInset() before using it. Fixes bug http://bugzilla.lyx.org/show_bug.cgi?id=5099 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26369 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Text2.cpp b/src/Text2.cpp index 30faefd3f7..65c08044c2 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -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();