]> source.dussan.org Git - vaadin-framework.git/commitdiff
avoid npe's on node click in test bench
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 26 Nov 2007 13:08:12 +0000 (13:08 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 26 Nov 2007 13:08:12 +0000 (13:08 +0000)
svn changeset:2964/svn branch:trunk

src/com/itmill/toolkit/demo/testbench/TestBench.java
src/com/itmill/toolkit/tests/TestBench.java

index c455dc72ae95beb8667073f1b7e2198b79209a2e..090ee9fe0a781c8b0e44ac702172d9e9d024a652 100644 (file)
@@ -138,9 +138,16 @@ public class TestBench extends com.itmill.toolkit.Application implements
         bodyLayout.removeAllComponents();
         bodyLayout.setCaption(null);
 
-        String title = ((Class) menu.getValue()).getName();
-        bodyLayout.setCaption(title);
-        bodyLayout.addComponent(createTestable((Class) menu.getValue()));
+        Object o = menu.getValue();
+        if (o instanceof Class) {
+            Class c = (Class) o;
+            String title = c.getName();
+            bodyLayout.setCaption(title);
+            bodyLayout.addComponent(createTestable(c));
+        } else {
+            // NOP node selected
+        }
+
     }
 
     /**
index 48fd3cffe51c84f588006e0d8753da4c8cc13a79..6de3cc71117e2904c77f89aeae6e3a79b7dceb30 100644 (file)
@@ -143,9 +143,15 @@ public class TestBench extends com.itmill.toolkit.Application implements
         bodyLayout.removeAllComponents();
         bodyLayout.setCaption(null);
 
-        String title = ((Class) menu.getValue()).getName();
-        bodyLayout.setCaption(title);
-        bodyLayout.addComponent(createTestable((Class) menu.getValue()));
+        Object o = menu.getValue();
+        if (o instanceof Class) {
+            Class c = (Class) o;
+            String title = c.getName();
+            bodyLayout.setCaption(title);
+            bodyLayout.addComponent(createTestable(c));
+        } else {
+            // NOP node selected
+        }
     }
 
     /**