Skip to content
Snippets Groups Projects
Unverified Commit f3c09a0f authored by Ariya Hidayat's avatar Ariya Hidayat Committed by GitHub
Browse files

Custom expression editor: don't process invalid expression (#19533)

If the expression is not valid, i.e. there is an error message
associated with processing it, do not blindly continue with it, since it
leads to a potential rewrite of the expression (the rest of
the parser/compiler can tolerate certain brokenness).
parent 37c3ad42
No related merge requests found
......@@ -255,16 +255,18 @@ export default class ExpressionEditorTextfield extends React.Component {
this.setState({ errorMessage });
// whenever our input blurs we push the updated expression to our parent if valid
const expression = this.compileExpression();
if (expression) {
if (!isExpression(expression)) {
console.warn("isExpression=false", expression);
}
this.props.onChange(expression);
} else if (errorMessage) {
if (errorMessage) {
this.props.onError(errorMessage);
} else {
this.props.onError({ message: t`Invalid expression` });
const expression = this.compileExpression();
if (expression) {
if (!isExpression(expression)) {
console.warn("isExpression=false", expression);
}
this.props.onChange(expression);
} else {
this.props.onError({ message: t`Invalid expression` });
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment