summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/texteditor/syntaxhighlighter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp
index 441cc5132b..578c6f5677 100644
--- a/src/plugins/texteditor/syntaxhighlighter.cpp
+++ b/src/plugins/texteditor/syntaxhighlighter.cpp
@@ -509,7 +509,7 @@ void SyntaxHighlighter::setFormatWithSpaces(const QString &text, int start, int
QTextCharFormat visualSpaceFormat = d->whitespaceFormat;
visualSpaceFormat.setBackground(format.background());
- const int end = start + count;
+ const int end = std::min(start + count, text.length());
int index = start;
while (index != end) {