Skip to content

Commit

Permalink
fix: protect against NPE (#6103)
Browse files Browse the repository at this point in the history
  • Loading branch information
monperrus authored Dec 17, 2024
1 parent 1201a3d commit e27367c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public <E> void visitCtCase(CtCase<E> caseStatement) {
if (caseExpression instanceof CtFieldAccess<E> fieldAccess) {
final CtFieldReference variable = ((CtFieldAccess) caseExpression).getVariable();
// In noclasspath mode, we don't have always the type of the declaring type.
if ((fieldAccess.getTarget().isImplicit() || env.getComplianceLevel() < 21)
if (((fieldAccess.getTarget() != null && fieldAccess.getTarget().isImplicit()) || env.getComplianceLevel() < 21)
&& variable.getType() != null
&& variable.getDeclaringType() != null
&& variable.getType().getQualifiedName().equals(variable.getDeclaringType().getQualifiedName())) {
Expand Down

0 comments on commit e27367c

Please sign in to comment.