aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorscria1000 <91804886+scria1000@users.noreply.github.com>2023-01-24 15:53:36 +0000
committerGitHub <noreply@github.com>2023-01-24 15:53:36 +0000
commited738437e651057b4cde959593cc0505eef401f4 (patch)
tree2069be8392600805582bbe4169a85c9d89d74578 /app/src/main/java/ml/docilealligator
parent8d0fd823a4cec727bb2dd9075de26bf430c27824 (diff)
downloadinfinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.tar
infinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.tar.gz
infinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.tar.bz2
infinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.tar.lz
infinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.tar.xz
infinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.tar.zst
infinity-for-reddit-ed738437e651057b4cde959593cc0505eef401f4.zip
Additional checks for null or potentially empty array (#1341)
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
index 41b00634..16447653 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
@@ -118,7 +118,7 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
}
private void loadImage(ImageViewHolder holder) {
- if (galleryImages == null) {
+ if (galleryImages == null || galleryImages.isEmpty()) {
return;
}
@@ -146,6 +146,10 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
}
private void loadCaptionPreview(ImageViewHolder holder) {
+ if (galleryImages == null || galleryImages.isEmpty()) {
+ return;
+ }
+
String previewCaption = galleryImages.get(holder.getBindingAdapterPosition()).caption;
String previewCaptionUrl = galleryImages.get(holder.getBindingAdapterPosition()).captionUrl;
boolean previewCaptionIsEmpty = TextUtils.isEmpty(previewCaption);