From 619d6b846a5422298eca016e6e4515737b8bed93 Mon Sep 17 00:00:00 2001 From: scria1000 <91804886+scria1000@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:23:48 +0300 Subject: Add null check for GALLERY_DATA_KEY Without this null check, viewing a deleted comment whose OP also had a deleted gallery will cause the Parsing to fail. --- .../main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java index 0685170a..834db92f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java @@ -541,7 +541,7 @@ public class ParsePost { } } catch (IllegalArgumentException ignore) { } } else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) { - if (data.has(JSONUtils.GALLERY_DATA_KEY)) { + if (!data.isNull(JSONUtils.GALLERY_DATA_KEY)) { JSONArray galleryIdsArray = data.getJSONObject(JSONUtils.GALLERY_DATA_KEY).getJSONArray(JSONUtils.ITEMS_KEY); JSONObject galleryObject = data.getJSONObject(JSONUtils.MEDIA_METADATA_KEY); ArrayList gallery = new ArrayList<>(); -- cgit v1.2.3