Skip to content

Commit

Permalink
[NETBEANS-2350]NPE while doing auto complete in rule switch block
Browse files Browse the repository at this point in the history
  • Loading branch information
vikasprabhakar committed Apr 25, 2019
1 parent a50d777 commit 0b9fc68
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -2293,7 +2293,14 @@ private void insideSwitch(Env env) throws IOException {
}
if (lastCase != null) {
StatementTree last = null;
for (StatementTree stat : lastCase.getStatements()) {
List<? extends StatementTree> statements = lastCase.getStatements();
if (statements == null) {
Tree caseBody = TreeShims.getBody(lastCase);
if (caseBody instanceof StatementTree) {
statements = Collections.singletonList((StatementTree) caseBody);
}
}
for (StatementTree stat : statements) {
int pos = (int) sourcePositions.getStartPosition(root, stat);
if (pos == Diagnostic.NOPOS || offset <= pos) {
break;
Expand Down

0 comments on commit 0b9fc68

Please sign in to comment.