Skip to content

Commit

Permalink
Fixes #65 Null pointer Exeption in DeleteFromWithoutWhereCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPohl committed Feb 7, 2018
1 parent c8c5fdd commit caa1bc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public void visitPassthruStatement(PassthruStatementTree tree) {
String statement = null;
if (SyntacticEquivalence.skipParentheses(tree.expression()) instanceof LiteralTree) {
statement = ((LiteralTree) SyntacticEquivalence.skipParentheses(tree.expression())).value().trim();
} else if (SyntacticEquivalence
} else if (tree.expressionList()!=null
&& !tree.expressionList().parameters().isEmpty()
&& SyntacticEquivalence
.skipParentheses(tree.expressionList().parameters().get(0)) instanceof LiteralTree) {
statement = ((LiteralTree) SyntacticEquivalence.skipParentheses(tree.expressionList().parameters().get(0)))
.value().trim();
Expand Down
2 changes: 2 additions & 0 deletions esql-checks/src/test/resources/deleteFrom.esql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ CREATE COMPUTE MODULE a
PASSTHRU(('DELETE FROM users WHERE NAME=''name''')); --Ccompliant
PASSTHRU(STMT); --Compliant
PASSTHRU('SELECT * FROM dual'); --Compliant
PASSTHRU loadStatement(); --Compliant
PASSTHRU (); --Compliant
END;

END MODULE;

0 comments on commit caa1bc1

Please sign in to comment.