From 65240f403416efc82fb5ff9efce682291d426e89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Wed, 5 Sep 2012 11:38:05 +0300 Subject: [PATCH] Use main window as current UI if not already set #9443 --- server/src/com/vaadin/Application.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index e4e49391bb..9498534b4a 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -185,6 +185,11 @@ public class Application implements Terminal.ErrorListener, Serializable { throw new IllegalStateException( "mainWindow is attached to another application"); } + if (UI.getCurrent() == null) { + // Assume setting a main window from Application.init if there's + // no current UI -> set the main window as the current UI + UI.setCurrent(mainWindow); + } this.mainWindow = mainWindow; } -- 2.39.5