Skip to content

Commit

Permalink
Fix checking of empty expression when leaving an input text field
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Aug 20, 2024
1 parent d1f88fd commit 760d0c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dynamic_layers/dynamic_layers_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ def text_widget(widget) -> str:
def validate_expression(self, source: str):
""" Show a warning background if the expression is incorrect. """
widget = getattr(self, source)
text_input = self.text_widget(widget)
expression = QgsExpression(self.text_widget(widget))
if expression.hasEvalError() or expression.hasParserError():
if text_input and (expression.hasEvalError() or expression.hasParserError()):
if isinstance(widget, QLineEdit):
icon = QIcon(":/images/themes/default/mIconWarning.svg")
widget.addAction(icon, QLineEdit.LeadingPosition)
Expand Down

0 comments on commit 760d0c1

Please sign in to comment.