diff options
author | Henri Sara <henri.sara@itmill.com> | 2011-11-28 11:17:11 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2011-11-28 11:17:11 +0000 |
commit | c63f0db47a2ae65583cde9108fa9f5b852b153e7 (patch) | |
tree | c56c42ce69d64b9af7c58583cb6ea53666c0c3ad | |
parent | 2ae16a4393c187a954a6fbf0cfa2c0027994f416 (diff) | |
download | vaadin-framework-c63f0db47a2ae65583cde9108fa9f5b852b153e7.tar.gz vaadin-framework-c63f0db47a2ae65583cde9108fa9f5b852b153e7.zip |
#7988 TreeTable.setCollapsed() should not throw NPE if the component has not been rendered yet
svn changeset:22147/svn branch:6.7
-rw-r--r-- | src/com/vaadin/ui/Table.java | 8 | ||||
-rw-r--r-- | src/com/vaadin/ui/TreeTable.java | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index f8fe76a522..cd07465d07 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -3816,8 +3816,12 @@ public class Table extends AbstractSelect implements Action.Container, final LinkedList<Object> visible = new LinkedList<Object>(); final Object[][] cells = getVisibleCells(); - for (int i = 0; i < cells[CELL_ITEMID].length; i++) { - visible.add(cells[CELL_ITEMID][i]); + // may be null if the table has not been rendered yet (e.g. not attached + // to a layout) + if (null != cells) { + for (int i = 0; i < cells[CELL_ITEMID].length; i++) { + visible.add(cells[CELL_ITEMID][i]); + } } return visible; diff --git a/src/com/vaadin/ui/TreeTable.java b/src/com/vaadin/ui/TreeTable.java index fa80476fc8..171ee616e1 100644 --- a/src/com/vaadin/ui/TreeTable.java +++ b/src/com/vaadin/ui/TreeTable.java @@ -657,8 +657,8 @@ public class TreeTable extends Table implements Hierarchical { */ public void setCollapsed(Object itemId, boolean collapsed) { if (isCollapsed(itemId) != collapsed) { - if (null == toggledItemId && getVisibleItemIds().contains(itemId) - && !isRowCacheInvalidated()) { + if (null == toggledItemId && !isRowCacheInvalidated() + && getVisibleItemIds().contains(itemId)) { // optimization: partial refresh if only one item is // collapsed/expanded toggledItemId = itemId; |