Skip to content

Commit

Permalink
fix(import): fix NPE with import scanner (#1437)
Browse files Browse the repository at this point in the history
Close #1436
  • Loading branch information
surli authored and monperrus committed Jun 27, 2017
1 parent 3d3217a commit a3dec4f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/spoon/reflect/visitor/ImportScannerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,13 @@ private boolean declaringTypeIsLocalOrImported(CtTypeReference declaringType) {
private boolean isInCollisionWithLocalMethod(CtExecutableReference ref) {
CtType<?> typeDecl = ref.getParent(CtType.class);

String methodName = ref.getSimpleName();
if (typeDecl != null) {
String methodName = ref.getSimpleName();

for (CtMethod<?> method : typeDecl.getAllMethods()) {
if (method.getSimpleName().equals(methodName)) {
return true;
for (CtMethod<?> method : typeDecl.getAllMethods()) {
if (method.getSimpleName().equals(methodName)) {
return true;
}
}
}
return false;
Expand Down

0 comments on commit a3dec4f

Please sign in to comment.