]> git.lyx.org Git - features.git/commitdiff
Fix bug 3177:
authorAbdelrazak Younes <younes@lyx.org>
Tue, 30 Jan 2007 13:54:28 +0000 (13:54 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 30 Jan 2007 13:54:28 +0000 (13:54 +0000)
http://bugzilla.lyx.org/show_bug.cgi?id=3177

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

src/TocBackend.C
src/frontends/qt4/QToc.C

index fd714ce56221fc49bd38cfc0412fae3956c1a80b..1101b968d9a276ad99b8b7336fd608d6b5a47b67 100644 (file)
@@ -203,6 +203,9 @@ TocIterator const TocBackend::item(
        Toc const & toc_vector = toclist_it->second;
        TocIterator last = toc_vector.begin();
        TocIterator it = toc_vector.end();
+       if (it == last)
+               return it;
+
        --it;
 
        for (; it != last; --it) {
index 840ce3a962ae07b6a6c82e8f36b291b5dcd4cd7c..eeec2489aa634af038b6ed95084d8f65845a2206 100644 (file)
@@ -92,7 +92,7 @@ QModelIndex const QToc::getCurrentIndex()
 {
        vector<string> const & types = getTypes();
        TocIterator const it = getCurrentTocItem(types[type_]);
-       if (!it->isValid()) {
+       if (it == getContents(types[type_]).end() || !it->isValid()) {
                lyxerr[Debug::GUI] << "QToc::getCurrentIndex(): TocItem is invalid!" << endl;
                return QModelIndex();
        }