From 17321b90ad29227eb5969b231f135d3fd745f976 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sat, 20 Oct 2007 21:27:22 +0000 Subject: [PATCH] Fix some bugs git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21091 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/FontList.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/FontList.cpp b/src/FontList.cpp index 7ffd6ed036..7d46e8bf0c 100644 --- a/src/FontList.cpp +++ b/src/FontList.cpp @@ -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; } }