Commit fd4a27db authored by topjohnwu's avatar topjohnwu

Fix NPE when unexpected network drop

Fix #839
parent 9c63e31d
...@@ -92,6 +92,10 @@ public class UpdateRepos { ...@@ -92,6 +92,10 @@ public class UpdateRepos {
req.addHeaders(Const.Key.IF_NONE_MATCH, etag); req.addHeaders(Const.Key.IF_NONE_MATCH, etag);
} }
ANResponse<JSONArray> res = req.build().executeForJSONArray(); ANResponse<JSONArray> res = req.build().executeForJSONArray();
// Network drop
if (res.getOkHttpResponse() == null)
return false;
// JSON not updated
if (res.getOkHttpResponse().code() == HttpURLConnection.HTTP_NOT_MODIFIED) if (res.getOkHttpResponse().code() == HttpURLConnection.HTTP_NOT_MODIFIED)
return false; return false;
// Current page is the last page // Current page is the last page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment