From 50fac3a5cf115ab5555628c7fa84b40c79cb7cc2 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 20 Mar 2016 11:11:24 +0100 Subject: [PATCH] Make sure, we fail early if we can't parse the code --- .../java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java | 4 ++++ 1 file changed, 4 insertions(+) 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) {