bool DocIterator::inRegexped() 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;
}
case LFUN_REGEXP_MODE: {
}
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);
}
cur.macroModeClose();
docstring const save_selection = grabAndEraseSelection(cur);
// look if there is no other macro in edit mode above
++i;
for (; i != cur.depth(); ++i) {
// 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
}
// ok, none found, I am the highest one