]> git.lyx.org Git - features.git/commitdiff
Fix some bugs
authorAbdelrazak Younes <younes@lyx.org>
Sat, 20 Oct 2007 21:27:22 +0000 (21:27 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 20 Oct 2007 21:27:22 +0000 (21:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21091 a592a061-630c-0410-9148-cb99ea01b6c8

src/FontList.cpp

index 7ffd6ed036d1a0ced6143b312eb7858ff5d171cd..7d46e8bf0ccd04876595ccde67bb7a31223ee060 100644 (file)
@@ -80,19 +80,21 @@ void FontList::erase(pos_type pos)
        iterator beg = list_.begin();
        if (it != list_.end() && it->pos() == pos
                && (pos == 0 
-                       || (it != beg && boost::prior(it)->pos() == pos - 1))) {
+                       || (it != list_.begin() && boost::prior(it)->pos() == pos - 1))) {
 
                // If it is a multi-character font
                // entry, we just make it smaller
                // (see update below), otherwise we
                // should delete it.
-               unsigned int const i = it - beg;
-               list_.erase(beg + i);
-               it = beg + i;
+               unsigned int const i = it - list_.begin();
+               list_.erase(it);
+               if (i >= list_.size())
+                       return;
+               it = list_.begin() + i;
                if (i > 0 && i < list_.size() &&
                    list_[i - 1].font() == list_[i].font()) {
                        list_.erase(beg + i - 1);
-                       it = beg + i - 1;
+                       it = list_.begin() + i - 1;
                }
        }