From f8a5dc9d6100175dec6ea6535152a28a3b685cea Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 20 Dec 2021 18:54:29 +0800 Subject: Fix app crashes when fetching gfycat videos failed for autoplay. --- .../infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java | 2 +- .../java/ml/docilealligator/infinityforreddit/FetchStreamableVideo.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java index e97b0ff4..19e720b5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java @@ -60,7 +60,7 @@ public class FetchGfycatOrRedgifsVideoLinks { } } catch (IOException e) { e.printStackTrace(); - fetchGfycatOrRedgifsVideoLinksListener.failed(-1); + handler.post(() -> fetchGfycatOrRedgifsVideoLinksListener.failed(-1)); } }); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchStreamableVideo.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchStreamableVideo.java index c310539a..91fc164c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchStreamableVideo.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchStreamableVideo.java @@ -39,6 +39,7 @@ public class FetchStreamableVideo { } } catch (IOException | JSONException e) { e.printStackTrace(); + handler.post(fetchStreamableVideoListener::failed); } }); } @@ -64,6 +65,7 @@ public class FetchStreamableVideo { } } catch (IOException | JSONException e) { e.printStackTrace(); + handler.post(fetchStreamableVideoListener::failed); } }); } -- cgit v1.2.3