WICKET-5462 fix npe in ajax form component label repainting

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/af05b3d6
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/af05b3d6
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/af05b3d6

Branch: refs/heads/sandbox/WICKET-4686
Commit: af05b3d68ca8b8021db8e205d39557782eb68a7b
Parents: a3a5a40
Author: Igor Vaynberg <[email protected]>
Authored: Mon Jan 6 10:26:46 2014 -0800
Committer: Igor Vaynberg <[email protected]>
Committed: Mon Jan 6 10:27:22 2014 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/wicket/markup/html/form/Form.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/af05b3d6/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index 94f93a5..7eeb1e1 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -774,10 +774,10 @@ public class Form<T> extends WebMarkupContainer 
implements IFormSubmitListener,
                        callOnError(submitter);
                }
 
-
-               if (((WebRequest)getRequest()).isAjax())
+               // update auto labels if we are inside an ajax request
+               final AjaxRequestTarget target = 
getRequestCycle().find(AjaxRequestTarget.class);
+               if (target != null)
                {
-                       final AjaxRequestTarget target = 
getRequestCycle().find(AjaxRequestTarget.class);
                        visitChildren(FormComponent.class, new 
IVisitor<FormComponent<?>, Void>()
                        {
                                @Override

Reply via email to