Skip to content

Commit eeb0400

Browse files
fix: avoid NPE and expose modifier
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com>
1 parent 8810c01 commit eeb0400

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/net/sf/jsqlparser/statement/select/SetOperation.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,29 @@
1313
import net.sf.jsqlparser.statement.select.SetOperationList.SetOperationType;
1414

1515
public abstract class SetOperation extends ASTNodeAccessImpl {
16-
String modifier = "";
16+
String modifier;
17+
18+
public String getModifier() {
19+
return modifier != null ? modifier : "";
20+
}
1721

1822
public boolean isAll() {
19-
return modifier.contains("ALL");
23+
return modifier != null && modifier.contains("ALL");
2024
}
2125

2226
public void setAll(boolean all) {
2327
this.modifier = "ALL";
2428
}
2529

2630
public boolean isDistinct() {
27-
return modifier.contains("DISTINCT");
31+
return modifier != null && modifier.contains("DISTINCT");
2832
}
2933

3034
public void setDistinct(boolean distinct) {
3135
this.modifier = "DISTINCT";
3236
}
3337

34-
private SetOperationType type;
38+
private final SetOperationType type;
3539

3640
public SetOperation(SetOperationType type) {
3741
this.type = type;

0 commit comments

Comments
 (0)