summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/Window.java
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-11-21 12:20:34 +0200
committerLeif Åstrand <leif@vaadin.com>2011-11-21 12:20:34 +0200
commit3bc8621c02fbd2c0b0c1a4995b262e81552d8330 (patch)
treed2fcbba3a552fdb834dbab2d2caae988dae8e8e9 /src/com/vaadin/ui/Window.java
parentb9d78241b9fd406570fefdaa6e82b24387c9948f (diff)
downloadvaadin-framework-3bc8621c02fbd2c0b0c1a4995b262e81552d8330.tar.gz
vaadin-framework-3bc8621c02fbd2c0b0c1a4995b262e81552d8330.zip
Window.close shouldn't throw npe even if not attached to any root
Diffstat (limited to 'src/com/vaadin/ui/Window.java')
-rw-r--r--src/com/vaadin/ui/Window.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java
index f9e22697ce..037bb64873 100644
--- a/src/com/vaadin/ui/Window.java
+++ b/src/com/vaadin/ui/Window.java
@@ -296,10 +296,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
*/
public void close() {
Root root = getRoot();
- // focus is restored to the parent window
- root.focus();
- // subwindow is removed from the root
- root.removeWindow(this);
+
+ // Don't do anything if not attached to a root
+ if (root != null) {
+ // focus is restored to the parent window
+ root.focus();
+ // subwindow is removed from the root
+ root.removeWindow(this);
+ }
}
/**