Additional checks for null or potentially empty array (#1341)

This commit is contained in:
scria1000 2023-01-24 15:53:36 +00:00 committed by GitHub
parent 8d0fd823a4
commit ed738437e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);