summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-02-07 14:39:40 +0200
committerLeif Åstrand <leif@vaadin.com>2012-02-07 14:39:40 +0200
commit87c3bf1e50ad6949e1fedff2429d41e79abfc971 (patch)
tree755e3a9fe4dc19d34fd63ca1eb46f4be88916ab2
parent41bffeb84c7f351730a0fee8b3fa69ac488f865b (diff)
downloadvaadin-framework-87c3bf1e50ad6949e1fedff2429d41e79abfc971.tar.gz
vaadin-framework-87c3bf1e50ad6949e1fedff2429d41e79abfc971.zip
getParent() shouldn't throw npe when widget's parent is null
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java
index 474e9c416d..9747deacd1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java
@@ -15,7 +15,7 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget {
private ApplicationConnection connection;
private String id;
private VPaintableWidgetContainer parent;
-
+
/* State variables */
private boolean enabled = true;
@@ -86,21 +86,24 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget {
}
public VPaintableWidgetContainer getParent() {
- if (parent != null)
+ if (parent != null) {
return parent;
-
+ }
+
// FIXME: Hierarchy should be set by framework instead of looked up here
VPaintableMap paintableMap = VPaintableMap.get(getConnection());
Widget w = getWidgetForPaintable();
- while (w != null) {
+ while (true) {
w = w.getParent();
+ if (w == null) {
+ return null;
+ }
if (paintableMap.isPaintable(w)) {
- parent = (VPaintableWidgetContainer) paintableMap.getPaintable(w);
+ parent = (VPaintableWidgetContainer) paintableMap
+ .getPaintable(w);
return parent;
}
}
-
- return null;
}
}