Skip to content

Commit

Permalink
ASTDiff: Add a null check for common comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pouryafard75 committed Oct 2, 2024
1 parent 2f24a8b commit f8d5900
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ public CommentMatcher(UMLCommentListDiff commonComment) {

@Override
public void match(Tree srcTree, Tree dstTree, ExtendedMultiMappingStore mappingStore) {
for (Pair<UMLComment, UMLComment> 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<UMLComment, UMLComment> 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);
}
}
}
}
Expand Down

0 comments on commit f8d5900

Please sign in to comment.