summaryrefslogtreecommitdiff
path: root/louloulibs/utils/string.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-06-23 22:40:53 +0200
committerlouiz’ <louiz@louiz.org>2016-06-23 22:40:53 +0200
commit9206f4723b8c5feb8a96daa9c283d30cf73290e1 (patch)
treec993c1998e82bdd07e48dfaee9ac46e9a4085b47 /louloulibs/utils/string.cpp
parent6bd9b1ec1429024a49cf8b6d7be29f90f35110fa (diff)
downloadbiboumi-9206f4723b8c5feb8a96daa9c283d30cf73290e1.tar.gz
biboumi-9206f4723b8c5feb8a96daa9c283d30cf73290e1.tar.bz2
biboumi-9206f4723b8c5feb8a96daa9c283d30cf73290e1.tar.xz
biboumi-9206f4723b8c5feb8a96daa9c283d30cf73290e1.zip
Fix a bug in cut()
Diffstat (limited to 'louloulibs/utils/string.cpp')
-rw-r--r--louloulibs/utils/string.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/louloulibs/utils/string.cpp b/louloulibs/utils/string.cpp
index 2447f84..635e71a 100644
--- a/louloulibs/utils/string.cpp
+++ b/louloulibs/utils/string.cpp
@@ -16,7 +16,7 @@ std::vector<std::string> cut(const std::string& val, const std::size_t size)
// UTF-8 codepoints.
std::size_t s = 0;
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;
codepoint_size = utils::get_next_codepoint_size(val[pos + s]);