aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/syntaxhighlighter.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2017-05-29 00:43:39 +0300
committerOrgad Shaneh <orgads@gmail.com>2017-05-29 06:19:16 +0000
commitb7e562d32ba679d14aa21d87b515ae8615789074 (patch)
treef69ae3f5086a0c466bc7db686ec9db7d942f3ba8 /src/plugins/texteditor/syntaxhighlighter.cpp
parentdabab693e95ab8ac4706fa6276304f468cc5fb9a (diff)
SyntaxHighlighter: Fix crash when typing a quote at line end
in a py file. Change-Id: Icfed4db68e1183ab19dbaf83ab5c9b6083f88fca Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp')
-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) {