Skip to content

Commit 403e4df

Browse files
Merge pull request #20 from phdata/npe-formatting-comma
Remove NPE if comma exists before reserved word
2 parents ec223c5 + 9d24cf2 commit 403e4df

File tree

1 file changed

+1
-1
lines changed
  • src/main/java/com/github/vertical_blank/sqlformatter/core

1 file changed

+1
-1
lines changed

src/main/java/com/github/vertical_blank/sqlformatter/core/Formatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private String formatComma(Token token, String query) {
163163

164164
if (this.inlineBlock.isActive()) {
165165
return query;
166-
} else if (this.previousReservedWord.value.matches("(?i)^LIMIT$")) {
166+
} else if (this.previousReservedWord != null && this.previousReservedWord.value.matches("(?i)^LIMIT$")) {
167167
return query;
168168
} else {
169169
return this.addNewline(query);

0 commit comments

Comments
 (0)