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
{
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;
}

View File

@ -1011,11 +1011,14 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
}
case LFUN_REGEXP_MODE: {
InsetMathHull * i = cur.inset().asInsetMath()->asHullInset();
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);
selClearOrDel(cur);

View File

@ -164,10 +164,13 @@ 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();
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
return true;