From 78d7d512cbef31144106c05cfcc0ade7dcfad6fc Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 8 Oct 2017 09:28:23 +0800 Subject: [PATCH] Fix utf8::to_previous that could go before the begin iterator --- src/utf8.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utf8.hh b/src/utf8.hh index 68d0b48d..4d4de274 100644 --- a/src/utf8.hh +++ b/src/utf8.hh @@ -157,7 +157,7 @@ void to_previous(Iterator& it, const Iterator& begin) noexcept { if (it != begin) --it; - while (not is_character_start(*it)) + while (it != begin and not is_character_start(*it)) --it; } // returns an iterator to the previous character first byte