title: java.lang.NullPointerException on ArrayList size
body: <p>I'm looking for the equivalent word in the dabase by the ContextQuery method, and when a equivalent word is null the program must try to use the next index from words and add it up to the current to make it a two word, if the two word is still null the program will make it a three word looking for the next 2 values. And i'm getting a NullPointerException everytime</p>
  
  <pre><code>    for (int i = 0; i &lt; words.size(); i++)
        {           
            try {
              temp = QueryWithContext.query(words.get(i));
              if(temp == null &amp;&amp; temp.isEmpty() &amp;&amp; words.size() &gt;= i+1)
              {
              QueryWithContext.query(words.get(i)+" "+words.get(i+1));
              temp = QueryWithContext.query(words.get(i)+" "+words.get(i+1));
                  if(temp == null &amp;&amp; temp.isEmpty());
                      {
                      temp = words.get(i);
                      }
              }
              else if(temp == null &amp;&amp; temp.isEmpty() &amp;&amp; words.size() &gt;= i+2)
              {
                  temp = QueryWithContext.query(words.get(i)+" "+words.get(i+1)+" "+words.get(i+2));
                  if(temp == null &amp;&amp; temp.isEmpty());
                  {
                  temp = words.get(i);
                  }
              }
  
  
  
              System.out.println(temp);
              holder = holder +" "+ temp;
              counter++;
        }
  </code></pre>