From: Vincent van Ravesteijn Date: Wed, 27 Oct 2010 07:04:58 +0000 (+0000) Subject: Fix bug #6989: Be somewhat more secure with the homebrew dynamic asserts that were... X-Git-Tag: 2.0.0~2225 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=49beed74374324834745198cf90dba949070d603;p=features.git Fix bug #6989: Be somewhat more secure with the homebrew dynamic asserts that were changed in r35855. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35863 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 2c244ae2e1..3af7dcba93 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -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; } diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index d0c2397a2e..4a455a1485 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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); diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index da398683b0..3e4f440990 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -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