Fixes a bug in Tree where a null pointer exception can occur if a click event propagates to the root TreeItem, which can happen in IE6. We now check that the target item is not the root TreeItem.
Patch by: jlabanca
Review by: TBR (rajeev)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.5@3391 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/Tree.java b/user/src/com/google/gwt/user/client/ui/Tree.java
index 334f166..7d92b6d 100644
--- a/user/src/com/google/gwt/user/client/ui/Tree.java
+++ b/user/src/com/google/gwt/user/client/ui/Tree.java
@@ -797,7 +797,7 @@
collectElementChain(chain, getElement(), hElem);
TreeItem item = findItemByChain(chain, 0, root);
- if (item != null) {
+ if (item != null && item != root) {
if (item.getChildCount() > 0
&& DOM.isOrHasChild(item.getImageElement(), hElem)) {
item.setState(!item.getState(), true);
@@ -993,8 +993,6 @@
/**
* Move the tree focus to the specified selected item.
- *
- * @param
*/
private void moveFocus() {
HasFocus focusableWidget = curSelection.getFocusableWidget();