Fixed NPE when HTTP request returns error.