From f24fab0fa2a7d35a0883f04f38d5807773acb4e5 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Mon, 25 Feb 2019 12:24:48 +0100 Subject: [PATCH] fix brake when selecting a mediaccc channel form subscription page --- .../local/subscription/SubscriptionService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionService.java b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionService.java index f9e2d9583..7e80264e6 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionService.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionService.java @@ -147,11 +147,16 @@ public class SubscriptionService { } private boolean isSubscriptionUpToDate(final ChannelInfo info, final SubscriptionEntity entity) { - return info.getUrl().equals(entity.getUrl()) && + return equalsAndNotNull(info.getUrl(), entity.getUrl()) && info.getServiceId() == entity.getServiceId() && info.getName().equals(entity.getName()) && - info.getAvatarUrl().equals(entity.getAvatarUrl()) && - info.getDescription().equals(entity.getDescription()) && + equalsAndNotNull(info.getAvatarUrl(), entity.getAvatarUrl()) && + equalsAndNotNull(info.getDescription(), entity.getDescription()) && info.getSubscriberCount() == entity.getSubscriberCount(); } + + private boolean equalsAndNotNull(final Object o1, final Object o2) { + return (o1 != null && o2 != null) + && o1.equals(o2); + } }