Commit a142270d authored by Lorenz Haas's avatar Lorenz Haas Committed by David Schulz
Browse files

Beautifier: Fix possible endless loop

Change-Id: Ib2f98c2d761ea9abfd6a42ec30cf8318ee7bd575
Reviewed-by: default avatarOrgad Shaneh <>
Reviewed-by: default avatarDavid Schulz <>
parent 88309188
......@@ -59,9 +59,12 @@ void ConfigurationSyntaxHighlighter::setKeywords(const QStringList &keywords)
if (keywords.isEmpty())
// Check for empty keywords since they can cause an endless loop in highlightBlock().
QStringList pattern;
for (int i = 0, total = keywords.count(); i < total; ++i)
pattern << QRegExp::escape(;
foreach (const QString &word, keywords) {
if (!word.isEmpty())
pattern << QRegExp::escape(word);
m_expressionKeyword.setPattern(QLatin1String("(?:\\s|^)(") + pattern.join(QLatin1String("|"))
+ QLatin1String(")(?=\\s|\\:|\\=|\\,|$)"));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment