From 747745c6d5a39b447d16dc8a3ee9504473d55f52 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Tue, 16 Mar 2021 21:57:03 +0900 Subject: [PATCH] Use null safe equals. Fixes https://github.com/austinhuang0131/barinsta/issues/789 --- .../main/java/awais/instagrabber/adapters/FeedAdapterV2.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java b/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java index 3dffd41c..891d6a00 100644 --- a/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java +++ b/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java @@ -43,14 +43,15 @@ public final class FeedAdapterV2 extends ListAdapter DIFF_CALLBACK = new DiffUtil.ItemCallback() { @Override public boolean areItemsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) { - return oldItem.getPk().equals(newItem.getPk()); + return Objects.equals(oldItem.getPk(), newItem.getPk()); } @Override public boolean areContentsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) { final Caption oldItemCaption = oldItem.getCaption(); final Caption newItemCaption = newItem.getCaption(); - return oldItem.getPk().equals(newItem.getPk()) && Objects.equals(getCaptionText(oldItemCaption), getCaptionText(newItemCaption)); + return Objects.equals(oldItem.getPk(), newItem.getPk()) + && Objects.equals(getCaptionText(oldItemCaption), getCaptionText(newItemCaption)); } private String getCaptionText(final Caption caption) {