From 5d41b0656c694d827637c9966360346cf8612b74 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 2 Feb 2021 16:18:48 -0500 Subject: [PATCH] add extra check for claim to prevent crash --- dist/bundle.es.js | 2 +- src/redux/selectors/claims.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 09c7c98..a72c3f8 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2242,7 +2242,7 @@ const makeSelectClaimForUri = (uri, returnRepost = true) => reselect.createSelec return undefined; } - const repostedClaim = claim.reposted_claim; + const repostedClaim = claim && claim.reposted_claim; if (repostedClaim && returnRepost) { const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url; diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 21d335b..46f8158 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -119,7 +119,7 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) return undefined; } - const repostedClaim = claim.reposted_claim; + const repostedClaim = claim && claim.reposted_claim; if (repostedClaim && returnRepost) { const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url; @@ -259,8 +259,8 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) = const end = Number(page) * Number(PAGE_SIZE); return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos - .slice(start, end) - .map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url) + .slice(start, end) + .map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url) : []; } ); @@ -366,8 +366,8 @@ export const makeSelectDateForUri = (uri: string) => (claim.value.release_time ? claim.value.release_time * 1000 : claim.meta && claim.meta.creation_timestamp - ? claim.meta.creation_timestamp * 1000 - : null); + ? claim.meta.creation_timestamp * 1000 + : null); if (!timestamp) { return undefined; }