title: Spring Thyme Leaf checking for global errors results in NPE
body: <p>To display global errors created with Spring MVC with Thyme Leaf, I tried the example given at <a href="http://www.thymeleaf.org/doc/tutorials/2.1/thymeleafspring.html#global-errors" rel="nofollow">http://www.thymeleaf.org/doc/tutorials/2.1/thymeleafspring.html#global-errors</a>:</p>
  
  <p>That, is:</p>
  
  <p><code>&lt;div th:if="${#fields.hasGlobalErrors()}"&gt;</code></p>
  
  <p>and</p>
  
  <p><code>&lt;ul th:if="${#fields.hasErrors('global')}"&gt;</code></p>
  
  <p>and</p>
  
  <p><code>&lt;div th:if="${#fields.hasGlobalErrors()}"&gt;</code></p>
  
  <p>When I add them to my HTML, the page won't even render, nevermind about submitting the form. All the examples result in:</p>
  
  <p><code>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#fields.hasErrors('global')"</code></p>
  
  <p>I tried this with v2.1.4 and v.2.1.3 and got the same error. Bug or am I doing something wrong?</p>
  
  <p>Yes, the tags are all closed and properly formed. Yes, this code was within a form. Yes, all the other aspects of the form work without the global error check.</p>
  
  <p>Here is a short version of broken HTML:</p>
  
  <pre><code>&lt;form action="search.html" th:action="@{/auto/search}"&gt;
  &lt;p th:if="${#fields.hasErrors('global')}" th:errors="*{global}"&gt;
      Incorrect date
  &lt;/p&gt;
  &lt;input type="text" th:field="${command.stockNumber}" /&gt;
  &lt;select th:field="*{command.startYear}"&gt;
      &lt;option value="" th:each="year : ${modelYears}" th:value="${year}"
              th:text="${year}"&gt;&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And the controller..</p>
  
  <pre><code>@RequestMapping(value = "/auto/search", method = RequestMethod.POST)
  public String search(@Validated
                       @ModelAttribute("command")
                       AutoSearchCommand autoSearchCommand
                       BindingResult result, Model model) {
      return "search";
  }
  </code></pre>