From fd4a27dbf2851806741a3789423e9ec32b7d4f63 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 9 Dec 2018 03:28:28 -0500 Subject: [PATCH] Fix NPE when unexpected network drop Fix #839 --- .../full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java b/app/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java index a07c6ab9d..3566794f5 100644 --- a/app/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java +++ b/app/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java @@ -92,6 +92,10 @@ public class UpdateRepos { req.addHeaders(Const.Key.IF_NONE_MATCH, etag); } ANResponse res = req.build().executeForJSONArray(); + // Network drop + if (res.getOkHttpResponse() == null) + return false; + // JSON not updated if (res.getOkHttpResponse().code() == HttpURLConnection.HTTP_NOT_MODIFIED) return false; // Current page is the last page