Skip to content

Commit

Permalink
Issue #12291: fix bound condition in EmptyForInitializerPadCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
strkkk authored and pbludov committed Nov 1, 2022
1 parent 8bea3ca commit b7707eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -152,7 +152,7 @@ public void visitToken(DetailAST ast) {
final int[] line = getLineCodePoints(lineIdx);
final int before = ast.getColumnNo() - 1;
// don't check if semi at beginning of line
if (!CodePointUtil.hasWhitespaceBefore(before, line)) {
if (ast.getColumnNo() > 0 && !CodePointUtil.hasWhitespaceBefore(before, line)) {
if (option == PadOption.NOSPACE
&& CommonUtil.isCodePointWhitespace(line, before)) {
log(ast, MSG_PRECEDED, SEMICOLON);
Expand Down
Expand Up @@ -58,4 +58,9 @@ void method2()
;; ) {
}
}

void method3() {
for (
;;) {}
}
}

0 comments on commit b7707eb

Please sign in to comment.