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/9bd0e07b
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9bd0e07b
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9bd0e07b

Branch: refs/heads/wicket-6.x
Commit: 9bd0e07b3da4e8ed4405d3d625fab7034721e3c7
Parents: 2f52df6
Author: Igor Vaynberg <[email protected]>
Authored: Mon Jan 6 10:26:46 2014 -0800
Committer: Igor Vaynberg <[email protected]>
Committed: Mon Jan 6 10:26:46 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/9bd0e07b/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 a9ea6a6..918edec 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
@@ -778,10 +778,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