Skip to content

Commit

Permalink
Fix NPE in SourceRangeVerifier (when debugging)
Browse files Browse the repository at this point in the history
Some nodes may return null for structuralFeatures if those nodes are
usually not available at given AST/Preview level (eg
StringTemplateExpression.propertyDescriptors(apiLevel, previewEnabled).
So let's handle this possible null case more gracefully.
  • Loading branch information
mickaelistria authored and akurtakov committed Apr 5, 2024
1 parent 61fbe37 commit ea5c574
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public boolean preVisit2(ASTNode node) {
ASTNode previous = null;

List properties = node.structuralPropertiesForType();
if (properties == null) { // happens for some nodes that aren't usually available at AST level
return false;
}
for (Object p : properties) {
StructuralPropertyDescriptor property = (StructuralPropertyDescriptor) p;
if (property.isChildProperty()) {
Expand Down

0 comments on commit ea5c574

Please sign in to comment.