Skip to content

Commit a6f6ea1

Browse files
committed
Avoid NPE on missing method type in JodaTimeVisitor
1 parent bc40657 commit a6f6ea1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ public Javadoc visitReference(Javadoc.Reference reference, ExecutionContext ctx)
168168
J.MethodInvocation m = (J.MethodInvocation) super.visitMethodInvocation(method, ctx);
169169

170170
// internal method with Joda class as return type
171-
if (!method.getMethodType().getDeclaringType().isAssignableFrom(JODA_CLASS_PATTERN) &&
171+
if (method.getMethodType() != null &&
172+
!method.getMethodType().getDeclaringType().isAssignableFrom(JODA_CLASS_PATTERN) &&
172173
method.getType().isAssignableFrom(JODA_CLASS_PATTERN)) {
173174
return migrateNonJodaMethod(method, m);
174175
}

0 commit comments

Comments
 (0)