diff --git a/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java b/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java index 7882a03e7ca..efde524e11a 100644 --- a/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java +++ b/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java @@ -1001,6 +1001,9 @@ private static Set directAnnotationsAmong( * annotation inheritance (see JLS 9.6.4.3). */ public static boolean hasDirectAnnotationWithSimpleName(Symbol sym, String simpleName) { + if (sym == null) { + return false; + } if (sym instanceof MethodSymbol) { return hasDirectAnnotationWithSimpleName((MethodSymbol) sym, simpleName); }