title: Null object reference after checking != null
body: <p>I have weird problem with null checking. I'm using shared preferences where i have stored phonenumber.</p>
  
  <p><code>SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
  String number = settings.getString("number1", null);</code></p>
  
  <p>Before i use that String value i check if it's null</p>
  
  <pre><code>if(number != null){//trying to format number but it gives error: Attempt to invoke virtual method on a null object reference}
  </code></pre>
  
  <p>In my other app this works fine but in this project it gives me trouble.
  I dont understand if it has something to do with Services because working app is using background service and this uses JobIntentService.</p>
  
  <p>Can someone tell why this gives error?</p>