Skip to content

Commit 12600fb

Browse files
fix: avoid NPE
Signed-off-by: Andreas Reichel <[email protected]>
1 parent 1364fdc commit 12600fb

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/main/java/net/sf/jsqlparser/schema/Column.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ public Table getResolvedTable() {
244244
*/
245245
public Column setResolvedTable(Table resolvedTable) {
246246
// clone, not reference
247-
this.resolvedTable = new Table(resolvedTable.getFullyQualifiedName());
247+
this.resolvedTable =
248+
resolvedTable != null ? new Table(resolvedTable.getFullyQualifiedName()) : null;
248249
return this;
249250
}
250251
}

src/main/java/net/sf/jsqlparser/schema/Table.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,8 @@ public static Table[] setUnsetCatalogAndSchema(String currentCatalogName,
514514

515515
@Override
516516
public Table clone() {
517-
try {
518-
Table clone = (Table) super.clone();
519-
clone.setName(this.getFullyQualifiedName());
520-
clone.setResolvedTable(this.resolvedTable);
521-
return clone;
522-
} catch (CloneNotSupportedException e) {
523-
throw new AssertionError();
524-
}
517+
Table clone = new Table(this.getFullyQualifiedName());
518+
clone.setResolvedTable(this.resolvedTable != null ? this.resolvedTable.clone() : null);
519+
return clone;
525520
}
526521
}

0 commit comments

Comments
 (0)