check if 'claims' exists before looping over it

This commit is contained in:
Sean Yesmunt 2020-10-19 23:01:34 -04:00
parent 77b27fea99
commit 15737f9b09
2 changed files with 6 additions and 6 deletions

2
dist/bundle.es.js vendored
View file

@ -2518,7 +2518,7 @@ const makeSelectChannelPermUrlForClaimUri = (uri, includePrefix = false) => rese
}); });
const makeSelectMyChannelPermUrlForName = name => reselect.createSelector(selectMyChannelClaims, claims => { const makeSelectMyChannelPermUrlForName = name => reselect.createSelector(selectMyChannelClaims, claims => {
const matchingClaim = claims.find(claim => claim.name === name); const matchingClaim = claims && claims.find(claim => claim.name === name);
return matchingClaim ? matchingClaim.permanent_url : null; return matchingClaim ? matchingClaim.permanent_url : null;
}); });

View file

@ -667,7 +667,7 @@ export const makeSelectMyChannelPermUrlForName = (name: string) =>
createSelector( createSelector(
selectMyChannelClaims, selectMyChannelClaims,
claims => { claims => {
const matchingClaim = claims.find(claim => claim.name === name); const matchingClaim = claims && claims.find(claim => claim.name === name);
return matchingClaim ? matchingClaim.permanent_url : null; return matchingClaim ? matchingClaim.permanent_url : null;
} }
); );