]> git.lyx.org Git - features.git/commitdiff
fix crash.
authorAndré Pönitz <poenitz@gmx.net>
Sun, 6 Jul 2008 10:55:47 +0000 (10:55 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sun, 6 Jul 2008 10:55:47 +0000 (10:55 +0000)
that's not a proper solution, though.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25459 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiErrorList.cpp
src/frontends/qt4/GuiErrorList.h

index 7d48ace520e275a20e1cc6c7d0a9f95b97c11321..2bd1fc9fb271e8af0872f39e391fd3f913516d55 100644 (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;
 }
 
 
index 57e451a3283a5da393c1456149f6dfb30156b630..2553cdc560b05a2d92f8383315d285c236070647 100644 (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: