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
This commit is contained in:
Vincent van Ravesteijn 2010-10-27 07:04:58 +00:00
parent cf9112a3a3
commit 49beed7437
3 changed files with 18 additions and 9 deletions

View File

@ -91,8 +91,11 @@ DocIterator DocIterator::clone(Buffer * buffer) const
bool DocIterator::inRegexped() const bool DocIterator::inRegexped() const
{ {
InsetMathHull * i = inset().asInsetMath()->asHullInset(); InsetMath * im = inset().asInsetMath();
return i && i->getType() == hullRegexp; if (!im)
return false;
InsetMathHull * hull = im->asHullInset();
return hull && hull->getType() == hullRegexp;
} }

View File

@ -1011,10 +1011,13 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
} }
case LFUN_REGEXP_MODE: { case LFUN_REGEXP_MODE: {
InsetMathHull * i = cur.inset().asInsetMath()->asHullInset(); InsetMath * im = cur.inset().asInsetMath();
if (i && i->getType() == hullRegexp) { if (im) {
cur.message(_("Already in regular expression mode")); InsetMathHull * i = im->asHullInset();
break; if (i && i->getType() == hullRegexp) {
cur.message(_("Already in regular expression mode"));
break;
}
} }
cur.macroModeClose(); cur.macroModeClose();
docstring const save_selection = grabAndEraseSelection(cur); docstring const save_selection = grabAndEraseSelection(cur);

View File

@ -164,9 +164,12 @@ bool MathMacro::editMode(BufferView const * bv) const {
// look if there is no other macro in edit mode above // look if there is no other macro in edit mode above
++i; ++i;
for (; i != cur.depth(); ++i) { for (; i != cur.depth(); ++i) {
MathMacro const * macro = cur[i].asInsetMath()->asMacro(); InsetMath * im = cur[i].asInsetMath();
if (macro && macro->displayMode() == DISPLAY_NORMAL) if (im) {
return false; MathMacro const * macro = im->asMacro();
if (macro && macro->displayMode() == DISPLAY_NORMAL)
return false;
}
} }
// ok, none found, I am the highest one // ok, none found, I am the highest one