You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2020/09/29 17:35:42 UTC
[tapestry-5] branch master updated: TAP5-2643: NPE in Label when
corresponding form field isn't rendered
This is an automated email from the ASF dual-hosted git repository.
thiagohp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/master by this push:
new 0c3ef11 TAP5-2643: NPE in Label when corresponding form field isn't rendered
0c3ef11 is described below
commit 0c3ef11869225c2a8c3970404af20f9c34aa9f73
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Tue Sep 29 10:49:54 2020 -0300
TAP5-2643: NPE in Label when corresponding form field isn't rendered
---
.../java/org/apache/tapestry5/corelib/components/Label.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
index bc3fa8d..dd153b3 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
@@ -118,9 +118,13 @@ public class Label
labelElement.attribute("id", id);
labelElement.forceAttributes("for", fieldId);
- Element input = labelElement.getDocument().getElementById(field.getClientId());
- if (input != null) {
- input.attribute("aria-labelledby", id);
+ if (fieldId != null)
+ {
+ Element input = labelElement.getDocument().getElementById(field.getClientId());
+ if (input != null)
+ {
+ input.attribute("aria-labelledby", id);
+ }
}
decorator.insideLabel(field, labelElement);