Need to make sure we always end up with a Cell, even if it's null.

Fixes #4544.
This commit is contained in:
Andrew Raines 2013-12-24 11:01:01 -06:00
parent ababeaed38
commit c6199b611e
1 changed files with 10 additions and 13 deletions

View File

@ -85,18 +85,6 @@ public class Table {
return this;
}
public Table addCell(Cell cell) {
currentCells.add(cell);
// If we're in a value row, also populate the named column.
if (!inHeaders) {
String hdr = (String) headers.get(currentCells.indexOf(cell)).value;
map.get(hdr).add(cell);
}
return this;
}
public Table addCell(Object value) {
return addCell(value, "");
}
@ -130,7 +118,16 @@ public class Table {
mAttr.put(sAttr.substring(0, idx), sAttr.substring(idx + 1));
}
}
addCell(new Cell(value, mAttr));
Cell cell = new Cell(value, mAttr);
currentCells.add(cell);
// If we're in a value row, also populate the named column.
if (!inHeaders) {
String hdr = (String) headers.get(currentCells.indexOf(cell)).value;
map.get(hdr).add(cell);
}
return this;
}