[EMAIL PROTECTED] wrote:
Author: younes
Date: Fri Sep 12 14:55:35 2008
New Revision: 26369

URL: http://www.lyx.org/trac/changeset/26369
Log:
Test Paragraph::inInset() before using it. Fixes bug 
http://bugzilla.lyx.org/show_bug.cgi?id=5099

I think there's something fishy in there. I don't like at all this inset owner concept but I guess we should never be in a case where this is not initialized, should we?


Modified:
     lyx-devel/trunk/src/Text2.cpp

Modified: lyx-devel/trunk/src/Text2.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Text2.cpp?rev=26369
==============================================================================
--- lyx-devel/trunk/src/Text2.cpp (original)
+++ lyx-devel/trunk/src/Text2.cpp Fri Sep 12 14:55:35 2008
@@ -90,7 +90,8 @@
                // 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 @@
                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();




Reply via email to