Merge pull request #571 from scria1000/patch-2

Add null check for GALLERY_DATA_KEY
This commit is contained in:
Docile-Alligator 2021-12-07 21:11:20 +08:00 committed by GitHub
commit 8fea6f688a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -541,7 +541,7 @@ public class ParsePost {
} }
} catch (IllegalArgumentException ignore) { } } catch (IllegalArgumentException ignore) { }
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) { } 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); JSONArray galleryIdsArray = data.getJSONObject(JSONUtils.GALLERY_DATA_KEY).getJSONArray(JSONUtils.ITEMS_KEY);
JSONObject galleryObject = data.getJSONObject(JSONUtils.MEDIA_METADATA_KEY); JSONObject galleryObject = data.getJSONObject(JSONUtils.MEDIA_METADATA_KEY);
ArrayList<Post.Gallery> gallery = new ArrayList<>(); ArrayList<Post.Gallery> gallery = new ArrayList<>();