From 282817c1922ac36f9bc25fe82de66606f696579b Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Sun, 4 Dec 2022 19:51:07 +1100 Subject: Version v5.4.0-beta1. Minor bugs fixed. --- .../ml/docilealligator/infinityforreddit/ParseSubscribedThing.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java index 0683ddb6..e4d12a7f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java @@ -50,6 +50,7 @@ class ParseSubscribedThing { ArrayList subscribedUserData, ArrayList subredditData, ParseSubscribedSubredditsListener parseSubscribedSubredditsListener) { + this.parseSubscribedSubredditsListener = parseSubscribedSubredditsListener; try { jsonResponse = new JSONObject(response); this.accountName = accountName; @@ -60,16 +61,18 @@ class ParseSubscribedThing { newSubscribedSubredditData = new ArrayList<>(); newSubscribedUserData = new ArrayList<>(); newSubredditData = new ArrayList<>(); - this.parseSubscribedSubredditsListener = parseSubscribedSubredditsListener; } catch (JSONException e) { e.printStackTrace(); - parseSubscribedSubredditsListener.onParseSubscribedSubredditsFail(); } } @Override protected Void doInBackground(Void... voids) { try { + if (jsonResponse == null) { + parseFailed = true; + return null; + } JSONArray children = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY); for (int i = 0; i < children.length(); i++) { JSONObject data = children.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY); -- cgit v1.2.3