aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java
index ee729d96..28ba6dce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java
@@ -58,13 +58,18 @@ public class GlideImageGetter implements Html.ImageGetter {
BitmapDrawablePlaceholder drawable = new BitmapDrawablePlaceholder(textSize);
- Context context = container.get().getContext();
- if (!(context instanceof Activity && (((Activity) context).isFinishing() || ((Activity) context).isDestroyed()))) {
- container.get().post(() -> Glide.with(context)
- .asBitmap()
- .load(source)
- .into(drawable));
- }
+ container.get().post(() -> {
+ TextView textView = container.get();
+ if (textView != null) {
+ Context context = textView.getContext();
+ if (!(context instanceof Activity && (((Activity) context).isFinishing() || ((Activity) context).isDestroyed()))) {
+ Glide.with(context)
+ .asBitmap()
+ .load(source)
+ .into(drawable);
+ }
+ }
+ });
return drawable;
}