]> git.lyx.org Git - features.git/commitdiff
Fix bug #6989: Be somewhat more secure with the homebrew dynamic asserts that were...
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 27 Oct 2010 07:04:58 +0000 (07:04 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 27 Oct 2010 07:04:58 +0000 (07:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35863 a592a061-630c-0410-9148-cb99ea01b6c8

src/DocIterator.cpp
src/mathed/InsetMathNest.cpp
src/mathed/MathMacro.cpp

index 2c244ae2e11c224f20429b8eb764927084eeb404..3af7dcba93b96762e5055b8a8c6479ae89cdb38b 100644 (file)
@@ -91,8 +91,11 @@ DocIterator DocIterator::clone(Buffer * buffer) const
 
 bool DocIterator::inRegexped() const
 {
-       InsetMathHull * i = inset().asInsetMath()->asHullInset();
-       return i && i->getType() == hullRegexp;
+       InsetMath * im = inset().asInsetMath();
+       if (!im) 
+               return false;
+       InsetMathHull * hull = im->asHullInset();
+       return hull && hull->getType() == hullRegexp;
 }
 
 
index d0c2397a2e47b5fdb1e020b94421fb14cff8ddd9..4a455a1485cd242ebf5cc29bcc17546f5e0cf892 100644 (file)
@@ -1011,10 +1011,13 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_REGEXP_MODE: {
-               InsetMathHull * i = cur.inset().asInsetMath()->asHullInset();           
-               if (i && i->getType() == hullRegexp) {
-                       cur.message(_("Already in regular expression mode"));
-                       break;
+               InsetMath * im = cur.inset().asInsetMath();
+               if (im) {
+                       InsetMathHull * i = im->asHullInset();          
+                       if (i && i->getType() == hullRegexp) {
+                               cur.message(_("Already in regular expression mode"));
+                               break;
+                       }
                }
                cur.macroModeClose();
                docstring const save_selection = grabAndEraseSelection(cur);
index da398683b029062d5eb66e79c58a5f3803de1c71..3e4f4409901b3e9a490cd0f7a2ae06af37d411d5 100644 (file)
@@ -164,9 +164,12 @@ bool MathMacro::editMode(BufferView const * bv) const {
                        // look if there is no other macro in edit mode above
                        ++i;
                        for (; i != cur.depth(); ++i) {
-                               MathMacro const * macro = cur[i].asInsetMath()->asMacro();
-                               if (macro && macro->displayMode() == DISPLAY_NORMAL)
-                                       return false;
+                               InsetMath * im = cur[i].asInsetMath();
+                               if (im) {
+                                       MathMacro const * macro = im->asMacro();
+                                       if (macro && macro->displayMode() == DISPLAY_NORMAL)
+                                               return false;
+                               }
                        }
 
                        // ok, none found, I am the highest one