Fix crash due to the attempt to access paragraph() from within mathed while doing forward-search (bug #7992).

This should go to branch as well.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40636 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2012-01-20 10:44:07 +00:00
parent ae872178fb
commit af8cec47e9

View File

@ -3659,9 +3659,14 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
command = lyxrc.forward_search_pdf;
}
int row = doc_buffer->texrow().getRowFromIdPos(bv->cursor().paragraph().id(), bv->cursor().pos());
DocIterator tmpcur = bv->cursor();
// Leave math first
while (tmpcur.inMathed())
tmpcur.pop_back();
int row = tmpcur.inMathed() ? 0 : doc_buffer->texrow().getRowFromIdPos(
tmpcur.paragraph().id(), tmpcur.pos());
LYXERR(Debug::ACTION, "Forward search: row:" << row
<< " id:" << bv->cursor().paragraph().id());
<< " id:" << tmpcur.paragraph().id());
if (!row || command.empty()) {
dr.setMessage(_("Couldn't proceed."));
break;