diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java index 33c3835854..c5d353d2e1 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java @@ -48,6 +48,10 @@ public class ApexParser { final ApexTreeBuilder treeBuilder = new ApexTreeBuilder(); suppressMap = new HashMap<>(); + if (astRoot == null) { + throw new ParseException("Couldn't parse the source - there is not root node - Syntax Error??"); + } + ApexNode tree = treeBuilder.build(astRoot); return tree; } catch (IOException e) {