title: Null index exception in thymeleaf with a filled list
body: <p>I have a list on the java side which is not empty. But on the front end I have a null index exception. Do you have any idea?</p>
  
  <p>I have this code :</p>
  
  <pre><code>&lt;div th:if="!${#strings.endsWith(partitions[__${rowPartitionStat.index}__].nom,'_in')}"&gt;
  </code></pre>
  
  <p>I've also try this code without success :</p>
  
  <pre><code>&lt;div th:if="!${#strings.endsWith(*{partitions[__${rowPartitionStat.index}__].nom},'_in')}"&gt;
  </code></pre>
  
  <p>In the last case I have a parsing exception so I think the first one is better.</p>
  
  <p>The first one cause this exception :</p>
  
  <pre><code>2017-12-14 15:23:28.937 ERROR 8272 --- [nio-8990-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#strings.endsWith(partitions[0].instances[0].natures[0].nom,'_in')" (topologieCles:155)] with root cause
  
  org.springframework.expression.spel.SpelEvaluationException: EL1012E:(pos 9): Cannot index into a null value
      at org.springframework.expression.spel.ast.Indexer.getValueRef(Indexer.java:142) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.Indexer.getValueInternal(Indexer.java:89) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:57) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.MethodReference.getArguments(MethodReference.java:154) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.MethodReference.getValueRef(MethodReference.java:71) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:66) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:267) ~[spring-expression-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.thymeleaf.spring4.expression.SpelVariableExpressionEvaluator.evaluate(SpelVariableExpressionEvaluator.java:139) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.standard.expression.VariableExpression.executeVariable(VariableExpression.java:154) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  </code></pre>
  
  <p>whereas few lines later this line works fine :</p>
  
  <pre><code>&lt;label th:text="*{partitions[__${rowPartitionStat.index}__].nom}" class="col-sm-4 control-label"&gt;...&lt;/label&gt;
  </code></pre>
  
  <p>Here is an extract from the pom.xml :</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.4.2.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>