From 3bc8621c02fbd2c0b0c1a4995b262e81552d8330 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Mon, 21 Nov 2011 12:20:34 +0200 Subject: Window.close shouldn't throw npe even if not attached to any root --- src/com/vaadin/ui/Window.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/com') 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); + } } /** -- cgit v1.2.3