From 713b88ee96d21c9008b3eb944be4b3f92f4608c1 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Thu, 19 Dec 2024 00:44:25 +0100 Subject: [PATCH] Add null check to JodaTimeVisitor Fixes #634 --- .../java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java b/src/main/java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java index d0b56ccc1..855422c0f 100644 --- a/src/main/java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java +++ b/src/main/java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java @@ -210,7 +210,7 @@ public Javadoc visitReference(Javadoc.Reference reference, ExecutionContext ctx) } private J migrateMethodCall(MethodCall original, MethodCall updated) { - if (!original.getMethodType().getDeclaringType().isAssignableFrom(JODA_CLASS_PATTERN)) { + if (original.getMethodType() == null || !original.getMethodType().getDeclaringType().isAssignableFrom(JODA_CLASS_PATTERN)) { return updated; // not a joda type, no need to migrate } MethodTemplate template = AllTemplates.getTemplate(original);