diff --git a/src/main/java/org/refactoringminer/astDiff/matchers/wrappers/CommentMatcher.java b/src/main/java/org/refactoringminer/astDiff/matchers/wrappers/CommentMatcher.java index bea12cf79..b3ab85ee7 100644 --- a/src/main/java/org/refactoringminer/astDiff/matchers/wrappers/CommentMatcher.java +++ b/src/main/java/org/refactoringminer/astDiff/matchers/wrappers/CommentMatcher.java @@ -20,11 +20,13 @@ public CommentMatcher(UMLCommentListDiff commonComment) { @Override public void match(Tree srcTree, Tree dstTree, ExtendedMultiMappingStore mappingStore) { - for (Pair commonComment : commentListDiff.getCommonComments()) { - Tree srcComment = TreeUtilFunctions.findByLocationInfo(srcTree, commonComment.getLeft().getLocationInfo()); - Tree dstComment = TreeUtilFunctions.findByLocationInfo(dstTree, commonComment.getRight().getLocationInfo()); - if (srcComment != null && dstComment != null) { - mappingStore.addMapping(srcComment, dstComment); + if (commentListDiff.getCommonComments() != null) { + for (Pair commonComment : commentListDiff.getCommonComments()) { + Tree srcComment = TreeUtilFunctions.findByLocationInfo(srcTree, commonComment.getLeft().getLocationInfo()); + Tree dstComment = TreeUtilFunctions.findByLocationInfo(dstTree, commonComment.getRight().getLocationInfo()); + if (srcComment != null && dstComment != null) { + mappingStore.addMapping(srcComment, dstComment); + } } } }