Commit 9206f472 authored by louiz’'s avatar louiz’

Fix a bug in cut()

parent 6bd9b1ec
...@@ -16,7 +16,7 @@ std::vector<std::string> cut(const std::string& val, const std::size_t size) ...@@ -16,7 +16,7 @@ std::vector<std::string> cut(const std::string& val, const std::size_t size)
// UTF-8 codepoints. // UTF-8 codepoints.
std::size_t s = 0; std::size_t s = 0;
auto codepoint_size = utils::get_next_codepoint_size(val[pos + s]); auto codepoint_size = utils::get_next_codepoint_size(val[pos + s]);
while (s + codepoint_size <= size) while (s + codepoint_size <= size && pos + s < val.size())
{ {
s += codepoint_size; s += codepoint_size;
codepoint_size = utils::get_next_codepoint_size(val[pos + s]); codepoint_size = utils::get_next_codepoint_size(val[pos + s]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment