title: Null Check throws NullPointerException
body: <p>Sometimes it happens that I have written a code to check NullPointerException like below,</p>
  
  <pre><code>if(str!=null)
  {
      doSomething();
  } 
  </code></pre>
  
  <p>and the null check itself throws NUllPointerException.</p>
  
  <p>How to solve it.</p>
  
  <p>Edited:
  Actually this code was getting null pointer,</p>
  
  <pre><code>Map params = new HashMap();
  if(params != null &amp;&amp; params.get("requestType"))
  {
      //some null safe code goes here
  }
  </code></pre>
  
  <p>i understood later that params.get() was throwing null pointer exception.</p>