From: André Pönitz Date: Sun, 6 Jul 2008 10:55:47 +0000 (+0000) Subject: fix crash. X-Git-Tag: 1.6.10~4217 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6ee64a4812dfc1c8faf47d8ab6ab5d2104f1f383;p=features.git 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 --- diff --git a/src/frontends/qt4/GuiErrorList.cpp b/src/frontends/qt4/GuiErrorList.cpp index 7d48ace520..2bd1fc9fb2 100644 --- a/src/frontends/qt4/GuiErrorList.cpp +++ b/src/frontends/qt4/GuiErrorList.cpp @@ -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; } diff --git a/src/frontends/qt4/GuiErrorList.h b/src/frontends/qt4/GuiErrorList.h index 57e451a328..2553cdc560 100644 --- a/src/frontends/qt4/GuiErrorList.h +++ b/src/frontends/qt4/GuiErrorList.h @@ -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: