diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-01-23 01:56:13 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-01-23 01:56:13 +0000 |
commit | 54ef23c35760b1da140eac688cbb94bbcf213de1 (patch) | |
tree | c7cafa7aa1b133cdd1319cb0657e42f7b0220304 /app/src/main/java/ml | |
parent | f17350cc1d7301858f7e3b6336682a509ccf9691 (diff) | |
download | infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.tar infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.tar.gz infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.tar.bz2 infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.tar.lz infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.tar.xz infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.tar.zst infinity-for-reddit-54ef23c35760b1da140eac688cbb94bbcf213de1.zip |
Prevent a potential parsing error using the gfycat API.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java index a2a7d129..0aeb5eeb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java @@ -104,7 +104,12 @@ public class FetchGfycatOrRedgifsVideoLinks { .getJSONObject(JSONUtils.CONTENT_URLS_KEY) .getJSONObject(JSONUtils.WEBM_KEY) .getString(JSONUtils.URL_KEY); - mp4 = jsonObject.getJSONObject(JSONUtils.GFY_ITEM_KEY).getString(JSONUtils.MP4_URL_KEY); + mp4 = jsonObject.getJSONObject(JSONUtils.GFY_ITEM_KEY).has(JSONUtils.MP4_URL_KEY) ? + jsonObject.getJSONObject(JSONUtils.GFY_ITEM_KEY).getString(JSONUtils.MP4_URL_KEY) + : jsonObject.getJSONObject(JSONUtils.GFY_ITEM_KEY) + .getJSONObject(JSONUtils.CONTENT_URLS_KEY) + .getJSONObject(JSONUtils.MP4_KEY) + .getString(JSONUtils.URL_KEY); } catch (JSONException e) { e.printStackTrace(); parseFailed = true; |