Revision: 3868
Author: [email protected]
Date: Wed Aug 11 11:38:32 2010
Log: Fixed an NPE in the DBTree
http://code.google.com/p/power-architect/source/detail?r=3868

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java Thu Aug 5 12:09:29 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java Wed Aug 11 11:38:32 2010
@@ -927,11 +927,13 @@
         getActionMap().put(KEY_LEFT, new AbstractAction() {
             public void actionPerformed(ActionEvent e) {
                 TreePath selection = getSelectionPath();
- if (isExpanded(selection) && treeModel.getChildCount(selection.getLastPathComponent()) != 0) {
-                    setExpandedState(selection, false);
-                } else {
-                    if (selection.getPathCount() != 2) {
-                        setSelectionPath(selection.getParentPath());
+                if (selection != null) {
+ if (isExpanded(selection) && treeModel.getChildCount(selection.getLastPathComponent()) != 0) {
+                        setExpandedState(selection, false);
+                    } else {
+                        if (selection.getPathCount() != 2) {
+                            setSelectionPath(selection.getParentPath());
+                        }
                     }
                 }
             }
@@ -940,8 +942,10 @@
         getActionMap().put(KEY_RIGHT, new AbstractAction() {
             public void actionPerformed(ActionEvent e) {
                 TreePath selection = getSelectionPath();
- if (!(treeModel.isLeaf(selection.getLastPathComponent()) | | isExpanded(selection))) {
-                    setExpandedState(selection, true);
+                if (selection != null) {
+ if (!(treeModel.isLeaf(selection.getLastPathComponent()) || isExpanded(selection))) {
+                        setExpandedState(selection, true);
+                    }
                 }
             }
         });

Reply via email to