diff --git a/src/framework/ui/uitextedit.cpp b/src/framework/ui/uitextedit.cpp index 4b0b007827..fdf7b5a238 100644 --- a/src/framework/ui/uitextedit.cpp +++ b/src/framework/ui/uitextedit.cpp @@ -592,7 +592,7 @@ void UITextEdit::moveCursorVertically(bool) int UITextEdit::getTextPos(const Point& pos) { - const int textLength = m_text.length(); + const int textLength = std::min(m_glyphsCoords.size(), m_text.length()); // find any glyph that is actually on the int candidatePos = -1;