scripting / river5

A river-of-news RSS aggregator in JS running in Node.
MIT License
428 stars 122 forks source link

Fixing readFeed: error == Cannot read property 'pubDate' of null #11

Closed andrewshell closed 7 years ago

andrewshell commented 7 years ago

Frank McPherson posted on the Google Group in thread River5.js shutdown that while debugging an issue he had hundreds of errors in the logfile saying:

readFeed: error == Cannot read property 'pubDate' of null

I personally didn't see any of these errors in my feed, but looking at the code and reading the documentation on Node Streams readable event I found:

In the former case, stream.read() will return the available data. In the latter case, stream.read() will return null.

My guess is there is some edge case with fetching an empty feed or something.

It's a simple enough check to see if item is null. If so we just return and don't do anything with it.