diff --git a/main/src/com/google/refine/model/ColumnModel.java b/main/src/com/google/refine/model/ColumnModel.java index 4bf1fb598..f310d3807 100644 --- a/main/src/com/google/refine/model/ColumnModel.java +++ b/main/src/com/google/refine/model/ColumnModel.java @@ -283,12 +283,17 @@ public class ColumnModel implements Jsonizable { _nameToColumn = new HashMap(); _cellIndexToColumn = new HashMap(); _columnNames = new ArrayList(); - + int maxCellIndex = -1; for (Column column : columns) { _nameToColumn.put(column.getName(), column); - _cellIndexToColumn.put(column.getCellIndex(), column); + int cidx = column.getCellIndex(); + if (cidx > maxCellIndex) { + maxCellIndex = cidx; + } + _cellIndexToColumn.put(cidx, column); _columnNames.add(column.getName()); } + _maxCellIndex = maxCellIndex; } /**