Skip to content

Commit cdca805

Browse files
awalter17imagejan
authored andcommitted
Initialize appended/inserted Column backing arrays
When appending or inserting a new column into a table, the backing arrays for those columns will now be initialized. This prevents null pointer exceptions when attempting to modify appended or inserted columns.
1 parent 9e35d9a commit cdca805

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/main/java/net/imagej/table/AbstractTable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ public ArrayList<C> insertColumns(final int col, final int count) {
143143
final ArrayList<C> result = new ArrayList<>(count);
144144
for (int c = 0; c < count; c++) {
145145
final C column = createColumn(null);
146+
// initialize array
147+
column.setSize(getRowCount());
146148
result.add(column);
147149
set(col + c, column);
148150
}

0 commit comments

Comments
 (0)