Skip to content

Commit fedcbf8

Browse files
author
chengyitian
committed
AJ-1011: fix null check for public BasicTable(final List<String> colNames, final List<Vector> cols);
1 parent 4a7669e commit fedcbf8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/com/xxdb/data/BasicTable.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ public BasicTable(final List<String> colNames, final List<Vector> cols) {
8585
throw new Error("The length of column name and column data is unequal.");
8686
}
8787

88-
int rowsCount = cols.get(0).rows();
88+
int rowsCount = -1;
8989
for (int i=0;i<cols.size();i++) {
9090
Vector v = cols.get(i);
91-
if(v.rows() != rowsCount)
91+
if (Objects.isNull(v))
92+
throw new RuntimeException("Column [" + colNames.get(i) + "] is null.");
93+
if(i == 0)
94+
rowsCount = v.rows();
95+
else if(v.rows() != rowsCount)
9296
throw new Error("The length of column " + colNames.get(i) + " must be the same as the first column length.");
9397
}
9498
this.setColName(colNames);

0 commit comments

Comments
 (0)