From a4c5cc660ffdec582d227715245d90191e46dd09 Mon Sep 17 00:00:00 2001 From: michaelvogt Date: Wed, 6 Mar 2013 14:11:59 +0200 Subject: #11265 AriaHandler NPE Fixes JavaScript exception when debug window is open Change-Id: Ic296cc643cf7b128c34d6446a05ea89a85bdcc35 --- client/src/com/vaadin/client/ui/AriaHelper.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/src/com/vaadin/client/ui/AriaHelper.java b/client/src/com/vaadin/client/ui/AriaHelper.java index e762ba57ce..f7b35add1d 100644 --- a/client/src/com/vaadin/client/ui/AriaHelper.java +++ b/client/src/com/vaadin/client/ui/AriaHelper.java @@ -24,16 +24,18 @@ public class AriaHelper { public static void bindCaption(Widget widget, Element captionElement) { assert widget != null : "Valid Widget required"; - ensureUniqueId(captionElement); + if (null != captionElement) { + ensureUniqueId(captionElement); - if (widget instanceof HandlesAriaCaption) { - ((HandlesAriaCaption) widget).handleAriaCaption(captionElement); - } else if (captionElement != null) { - String ownerId = ensureUniqueId(widget.getElement()); - captionElement.setAttribute("for", ownerId); + if (widget instanceof HandlesAriaCaption) { + ((HandlesAriaCaption) widget).handleAriaCaption(captionElement); + } else { + String ownerId = ensureUniqueId(widget.getElement()); + captionElement.setAttribute("for", ownerId); - Roles.getTextboxRole().setAriaLabelledbyProperty( - widget.getElement(), Id.of(captionElement)); + Roles.getTextboxRole().setAriaLabelledbyProperty( + widget.getElement(), Id.of(captionElement)); + } } else { Roles.getTextboxRole().removeAriaLabelledbyProperty( widget.getElement()); -- cgit v1.2.3