fix a minor crash

This commit is contained in:
Tim Felgentreff 2022-01-30 14:37:53 +01:00
parent 2a55642ed8
commit 8b4a2fb064

View file

@ -433,7 +433,7 @@ int UTF8GetPrev(const std::string &text, int curpos)
return curpos;
}
while (curpos >= 0) {
if ((text[curpos] & 0xC0) != 0x80) {
if (curpos < text.size() && (text[curpos] & 0xC0) != 0x80) {
return curpos;
}
--curpos;