8267481: Make sure table row has correct number of cells
Reviewed-by: jjg
This commit is contained in:
parent
f67847f52a
commit
b7b6acd9b1
@ -295,6 +295,9 @@ public class Table extends Content {
|
||||
if (tabMap != null && element == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (contents.size() != columnStyles.size()) {
|
||||
throw new IllegalArgumentException("row content size does not match number of columns");
|
||||
}
|
||||
|
||||
Content row = new ContentBuilder();
|
||||
|
||||
@ -323,9 +326,7 @@ public class Table extends Content {
|
||||
}
|
||||
int colIndex = 0;
|
||||
for (Content c : contents) {
|
||||
HtmlStyle cellStyle = (columnStyles == null || colIndex > columnStyles.size())
|
||||
? null
|
||||
: columnStyles.get(colIndex);
|
||||
HtmlStyle cellStyle = columnStyles.get(colIndex);
|
||||
// Replace invalid content with HtmlTree.EMPTY to make sure the cell isn't dropped
|
||||
HtmlTree cell = HtmlTree.DIV(cellStyle, c.isValid() ? c : HtmlTree.EMPTY);
|
||||
if (rowStyle != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user