title: Weird NullPointerException in Groovy inject
body: <pre><code>groovy:000&gt; ['homepages/gg','a','b','c','d'].inject([]) { list, conf -&gt; if (!conf.contains('homepage')) { list &lt;&lt; conf.trim() } }
  ERROR java.lang.NullPointerException:
  Cannot invoke method leftShift() on null object
          at groovysh_evaluate$_run_closure1.doCall (groovysh_evaluate:3)
  groovy:000&gt; ['homepages/gg','a','b','c','d'].inject([]) { list, conf -&gt; conf.contains('homepage') ? list : list &lt;&lt; conf.trim() }
  ===&gt; [a, b, c, d]
  </code></pre>
  
  <p>Why do I get a <code>NullPointerException</code> in the first case but not in the second? I am using Groovy 2.3.7.</p>