From 36918281c07054e93da4e0e9a376897335723b0b Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Fri, 10 Apr 2020 18:57:59 +0200 Subject: [PATCH] Fix: index out of bounds --- src/util/tagged_string.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/tagged_string.cpp b/src/util/tagged_string.cpp index 66f35530..263650a2 100644 --- a/src/util/tagged_string.cpp +++ b/src/util/tagged_string.cpp @@ -347,7 +347,7 @@ size_t cursor_to_index(const String& str, size_t cursor, Movement dir) { if (str.GetChar(i) == _('<')) { String tag1 = tag_at(str, i); i = skip_tag(str, i); - if (str.GetChar(i) == _('<')) { + if (i < str.size() && str.GetChar(i) == _('<')) { String tag2 = tag_at(str, i); if (_("<") + tag2 + _(">") == anti_tag(tag1)) { return i;