From 5f1775d4787ce633aa74c88eb07df375b9bc4a2f Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 5 Jun 2020 07:04:54 +0100 Subject: [PATCH] fix possible null item in channel id list --- .../io/lbry/browser/ui/channel/ChannelContentFragment.java | 2 +- .../io/lbry/browser/ui/findcontent/FollowingFragment.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java index 6f1cc613..467ae089 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java @@ -223,7 +223,7 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi (List) null, null, canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS), - Arrays.asList(channelId), + !Helper.isNullOrEmpty(channelId) ? Arrays.asList(channelId) : null, null, getContentSortOrder(), contentReleaseTime, diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java index 5bc5f32d..17d09b23 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java @@ -441,7 +441,7 @@ public class FollowingFragment extends BaseFragment implements private List getChannelIds() { if (channelFilterListAdapter != null) { Claim selected = channelFilterListAdapter.getSelectedItem(); - if (selected != null) { + if (selected != null && !Helper.isNullOrEmpty(selected.getClaimId())) { return Arrays.asList(selected.getClaimId()); } } @@ -490,6 +490,11 @@ public class FollowingFragment extends BaseFragment implements String url = subscription.getUrl(); LbryUri uri = LbryUri.parse(url); String claimId = uri.getClaimId(); + if (Helper.isNullOrEmpty(claimId) || Helper.isNullOrEmpty(url)) { + // don't add null / empty claim IDs or URLs + continue; + } + channelIds.add(claimId); channelUrls.add(url); } catch (LbryUriException ex) {