title: Facebook login error java.lang.NullPointerException
body: <p>I'm developing an android app with facebook login</p>
  
  <p>but facebook getuser sometimes return 0 
  and i found <code>java.lang.NullPointerException</code></p>
  
  <pre><code>$facebook = new Facebook(array(
    'appId'  =&gt; 'xxxx',
    'secret' =&gt; 'xxxx',
  cookie : false));
  
  $facebook-&gt;setAccessToken($token);
  
  $user = $facebook-&gt;getUser();
  
  if ($user) {
    try {
      $user_profile = $facebook-&gt;api('/me');
      $id = isset($user_profile['id']) ?
          $user_profile['id'] : ResultError(ERROR_INVALID);
      $name = isset($user_profile['name']) ? $user_profile['name'] : '';
      $email = isset($user_profile['email']) ? $user_profile['email'] : '';
      $gender = isset($user_profile['gender']) ? $user_profile['gender'] : '';
      $birth_date = isset($user_profile['birthday']) ?
          date("Y-m-d" , strtotime($user_profile['birthday'])) : '';
      $region = isset($user_profile['location']['name']) ?
          $user_profile['location']['name'] : '';
    } catch (FacebookApiException $e) {
        error_log($e);
        $user=null;
  </code></pre>
  
  <p>and here is the stack</p>
  
  <pre><code>    java.lang.NullPointerException
      at com.stamproad.stamproad.subroad.StorePagerAdapter$7.onClick(StorePagerAdapter.java:467)
      at android.view.View.performClick(View.java:4084)
      at android.view.View$PerformClick.run(View.java:16966)
      at android.os.Handler.handleCallback(Handler.java:615)
      at android.os.Handler.dispatchMessage(Handler.java:92)
      at android.os.Looper.loop(Looper.java:137)
      at android.app.ActivityThread.main(ActivityThread.java:4745)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>