title: Null Pointer Exception: null error
body: <p>I have this Hash Set code and when I try to run my compile method on it I get the Null Pointer Exception: null  error on it. Here is the code:</p>
  
  <pre><code>private void initKeywords() {
          keywords = new HashSet&lt;String&gt;();
          keywords.add("final");
          keywords.add("int");
          keywords.add("while");
          keywords.add("if");
          keywords.add("else");
          keywords.add("print");     
      }
  
      private boolean isIdent(String t) {
          if (keywords.contains(t)) {  ***//This is the line I get the Error***
              return false;
          }
          else if (t != null &amp;&amp; t.length() &gt; 0 &amp;&amp; Character.isLetter(t.charAt(0))) {
              return true;
          }
          else {
              return false;
          }
      }
  </code></pre>
  
  <p>The other lines that goes along with this error is: </p>
  
  <pre><code>public void compileProgram() {        
          System.out.println("compiling " + filename);
          while (theToken != null) {
              if (equals(theToken, "int") || equals(theToken, "final")) {
                  compileDeclaration(true);
              } else {
                  compileFunction(); //This line is giving an error with the above error
              }
          }
          cs.emit(Machine.HALT);
          isCompiled = true;
      }
  
  
  
  private void compileFunction() {
          String fname = theToken;
          int entryPoint = cs.getPos();  
          if (equals(fname, "main")) {
              cs.setEntry(entryPoint);
          } 
          if (isIdent(theToken)) theToken = t.token(); ***//This line is giving an error***
          else t.error("expecting identifier, got " + theToken);
  
          symTable.allocProc(fname,entryPoint);
  
  
         accept("(");
          compileParamList();
          accept(")");
          compileCompound(true);
          if (equals(fname, "main")) cs.emit(Machine.HALT);
          else cs.emit(Machine.RET);
      }
  </code></pre>