Fix utf8::to_previous that could go before the begin iterator

This commit is contained in:
Maxime Coste 2017-10-08 09:28:23 +08:00
parent 397e5ef0e1
commit 78d7d512cb

View File

@ -157,7 +157,7 @@ void to_previous(Iterator& it, const Iterator& begin) noexcept
{ {
if (it != begin) if (it != begin)
--it; --it;
while (not is_character_start(*it)) while (it != begin and not is_character_start(*it))
--it; --it;
} }
// returns an iterator to the previous character first byte // returns an iterator to the previous character first byte