diff --git a/src/main/java/gumtree/spoon/AstComparator.java b/src/main/java/gumtree/spoon/AstComparator.java index 04eadcb1..bb726e1b 100644 --- a/src/main/java/gumtree/spoon/AstComparator.java +++ b/src/main/java/gumtree/spoon/AstComparator.java @@ -57,7 +57,13 @@ protected Factory createFactory() { * compares two java files */ public Diff compare(File f1, File f2) throws Exception { - return this.compare(getCtType(f1), getCtType(f2)); + CtType ctType1 = getCtType(f1); + CtType ctType2 = getCtType(f2); + if (ctType1 == null || ctType2 == null) { + return null; + } else { + return compare(ctType1, ctType2); + } } /**