Issue #3681: fixed NPE in RightCurly when do has no curlies

This commit is contained in:
rnveach 2017-01-04 21:14:38 -05:00 committed by Roman Ivanov
parent 54058853b9
commit 2c81de1bb0
2 changed files with 7 additions and 1 deletions

View File

@ -370,7 +370,9 @@ public class RightCurlyCheck extends AbstractCheck {
case TokenTypes.LITERAL_DO:
nextToken = ast.findFirstToken(TokenTypes.DO_WHILE);
lcurly = ast.findFirstToken(TokenTypes.SLIST);
rcurly = lcurly.getLastChild();
if (lcurly != null) {
rcurly = lcurly.getLastChild();
}
break;
default:
// ATTENTION! We have default here, but we expect case TokenTypes.METHOD_DEF,

View File

@ -90,5 +90,9 @@ public class InputRightCurlyDoWhile {
public void foo9() {
do {} while (true);
}
public void foo10() {
do ; while (true);
}
}