fix crash.

that's not a proper solution, though.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25459 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-07-06 10:55:47 +00:00
parent aabd9d03bb
commit 6ee64a4812
2 changed files with 10 additions and 7 deletions

View File

@ -60,8 +60,8 @@ void GuiErrorList::showEvent(QShowEvent * e)
void GuiErrorList::select()
{
int const item = errorsLW->row(errorsLW->currentItem());
goTo(item);
descriptionTB->setPlainText(toqstr(errorList()[item].description));
if (goTo(item))
descriptionTB->setPlainText(toqstr(errorList()[item].description));
}
@ -94,19 +94,21 @@ bool GuiErrorList::initialiseParams(string const & error_type)
}
void GuiErrorList::goTo(int item)
bool GuiErrorList::goTo(int item)
{
ErrorItem const & err = errorList()[item];
if (err.par_id == -1)
return;
return false;
Buffer & buf = buffer();
DocIterator dit = buf.getParFromID(err.par_id);
if (dit == doc_iterator_end(buf.inset())) {
// FIXME: Happens when loading a read-only doc with
// unknown layout. Should this be the case?
LYXERR0("par id " << err.par_id << " not found");
return;
return false;
}
// Now make the selection.
@ -119,6 +121,7 @@ void GuiErrorList::goTo(int item)
bufferview()->putSelectionAt(dit, range, false);
// FIXME: If we used an LFUN, we would not need this line:
bufferview()->processUpdateFlags(Update::Force | Update::FitCursor);
return true;
}

View File

@ -46,8 +46,8 @@ private:
///
void dispatchParams() {}
/// goto this error in the parent bv
void goTo(int item);
/// goto this error in the parent bv. Returns success.
bool goTo(int item);
///
ErrorList const & errorList() const;
private: