summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractSingleComponentContainer.java')
-rw-r--r--server/src/com/vaadin/ui/AbstractSingleComponentContainer.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
index de1bb29846..ba108fc302 100644
--- a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
+++ b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
@@ -123,6 +123,12 @@ public abstract class AbstractSingleComponentContainer extends
*/
@Override
public void setContent(Component content) {
+ // Make sure we're not adding the component inside it's own content
+ if (isOrHasAncestor(content)) {
+ throw new IllegalArgumentException(
+ "Component cannot be added inside it's own content");
+ }
+
Component oldContent = getContent();
if (oldContent == content) {
// do not set the same content twice