Skip to content

Commit f854acb

Browse files
committed
Fix expression builder highlighting (#4913)
1 parent 6a44e11 commit f854acb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/gui/qgsexpressionhighlighter.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ void QgsExpressionHighlighter::addFields( QStringList fieldList )
5050
HighlightingRule rule;
5151
foreach( const QString field, fieldList )
5252
{
53+
if ( field.isEmpty() ) // this really happened :)
54+
continue;
5355
rule.pattern = QRegExp( "\\b" + field + "\\b" );
5456
rule.format = columnNameFormat;
5557
highlightingRules.append( rule );
@@ -65,6 +67,8 @@ void QgsExpressionHighlighter::highlightBlock( const QString &text )
6567
while ( index >= 0 )
6668
{
6769
int length = expression.matchedLength();
70+
if ( length == 0 )
71+
break; // avoid infinite loops
6872
setFormat( index, length, rule.format );
6973
index = expression.indexIn( text, index + length );
7074
}

0 commit comments

Comments
 (0)