When an Android app doesn't have the INTERNET permission, getHeaderFields() returns null resulting in NPE

I am testing a new app that didn't have the internet permission. I debugged it and ran in to xhr.getHeaderFields() returning a null; which led to an NPE.

I added a check for null to make the permission error a bit more transparent. Now an access denied error will propagate up instead of just a silent failure since the finally block basically throws the NPE away.