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
This commit is contained in:
Abdelrazak Younes 2008-09-12 12:55:35 +00:00
parent 34530817ee
commit 0743708418

View 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();