From b7e562d32ba679d14aa21d87b515ae8615789074 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 29 May 2017 00:43:39 +0300 Subject: SyntaxHighlighter: Fix crash when typing a quote at line end in a py file. Change-Id: Icfed4db68e1183ab19dbaf83ab5c9b6083f88fca Reviewed-by: David Schulz --- src/plugins/texteditor/syntaxhighlighter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp') 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) { -- cgit v1.2.1