Skip to content

Commit 9d24cf2

Browse files
author
Brock Noland
committed
Remove NPE if comma exists before reserved word for example when using Teradata's SEL for SELECT
Change-Id: I0724dc7ff8b8a908882578a9d0005d475d50062d
1 parent 8ca53c1 commit 9d24cf2

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)