mannynotfound / react-tweet

React.js component for rendering tweets as they are presented on Twitter.com
67 stars 43 forks source link

TypeError: Cannot read property 'forEach' of undefined #40

Open lraulin opened 5 years ago

lraulin commented 5 years ago

Apparently the free streaming API sometimes gives me tweets that have an entities prop that doesn't have a urls prop, causing react-tweet to crash my app with TypeError: Cannot read property 'forEach' of undefined because of line 86 in Text.js:

// remove any quote links
if (entities && data.quoted_status) {
          entities.urls.forEach(function(u) {

Simple fix: Change to: if (entities && entities.urls && data.quoted_status) {