title: Http Status Code in Android Volley when error.networkResponse is null
body: <p>I am using Google Volley on the Android platform.
  I am having a problem in which the <code>error</code> parameter in <code>onErrorResponse</code> is returning a null <code>networkResponse</code>
  For the RESTful API I am using, I need to determine the Http Status Code which is often arriving as 401 (SC_UNAUTHORIZED) or 500 (SC_INTERNAL_SERVER_ERROR), and I can occasionally check via:</p>
  
  <pre><code>final int httpStatusCode = error.networkResponse.statusCode;
  if(networkResponse == HttpStatus.SC_UNAUTHORIZED) {
      // Http status code 401: Unauthorized.
  }
  </code></pre>
  
  <p>This throws a <code>NullPointerException</code> because <code>networkResponse</code> is null.</p>
  
  <p>How can I determine the Http Status Code in the function <code>onErrorResponse</code>?</p>
  
  <p>Or, how can I ensure <code>error.networkResponse</code> is non-null in <code>onErrorResponse</code>?</p>