Skip to content

Commit

Permalink
Fix NPE in PurityChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 24, 2024
1 parent 325fcca commit b8d499c
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/main/java/org/refactoringminer/api/PurityChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -1914,19 +1914,20 @@ private static void checkForStatementsBeingMappedInTargetOperation(InlineOperati
UMLClassBaseDiff umlClassDiff = modelDiff.getUMLClassDiff(refactoring.getTargetOperationAfterInline().getClassName());
List<AbstractCodeFragment> nonMappedLeavesT1ToRemove = new ArrayList<>();


for (UMLOperationBodyMapper umlOperationBodyMapper : umlClassDiff.getOperationBodyMapperList()) {
if (umlOperationBodyMapper != null && umlOperationBodyMapper.getOperation2() != null) {
if (umlOperationBodyMapper.getOperation2().getName().equals(refactoring.getTargetOperationAfterInline().getName())) {
for (AbstractCodeFragment abstractCodeFragment : nonMappedLeavesT1) {
for (AbstractCodeMapping mapping : umlOperationBodyMapper.getMappings()) {
if (mapping.getFragment2().getString().equals(abstractCodeFragment.getString())) {
nonMappedLeavesT1ToRemove.add(abstractCodeFragment);
}
}
}
}
}
if (umlClassDiff != null) {
for (UMLOperationBodyMapper umlOperationBodyMapper : umlClassDiff.getOperationBodyMapperList()) {
if (umlOperationBodyMapper != null && umlOperationBodyMapper.getOperation2() != null) {
if (umlOperationBodyMapper.getOperation2().getName().equals(refactoring.getTargetOperationAfterInline().getName())) {
for (AbstractCodeFragment abstractCodeFragment : nonMappedLeavesT1) {
for (AbstractCodeMapping mapping : umlOperationBodyMapper.getMappings()) {
if (mapping.getFragment2().getString().equals(abstractCodeFragment.getString())) {
nonMappedLeavesT1ToRemove.add(abstractCodeFragment);
}
}
}
}
}
}
}
nonMappedLeavesT1.removeAll(nonMappedLeavesT1ToRemove);
}
Expand Down

0 comments on commit b8d499c

Please sign in to comment.