Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

authorName is null => Cannot read property 'length' of null #1198

Open
goaround opened this issue Jul 12, 2021 · 1 comment
Open

authorName is null => Cannot read property 'length' of null #1198

goaround opened this issue Jul 12, 2021 · 1 comment

Comments

@goaround
Copy link

Explanation

On my terms (categories, tags...) I always get the following error:

react-dom.min.js?ver=16.13.1:125 TypeError: Cannot read property 'length' of nullt FacebookSiteAndAuthorNames (FacebookSiteAndAuthorNames.js?6a79:66)

It happens because props.authorName is null on my sites and the functions check the props.authorName.length > 0:
https://github.com/goaround/javascript/blob/12520ef960f8c1f7789c337354f160a3fc3ac98c/packages/social-metadata-previews/src/facebook/FacebookSiteAndAuthorNames.js#L66

I would suggest to check first if props.authorName is not null before checking the length.

@goaround
Copy link
Author

Pull request: #1199

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant