developerdizzle / react-virtual-list

Super simple virtualized list React component
http://developerdizzle.github.io/react-virtual-list/
MIT License
617 stars 71 forks source link

Fix for TypeError from getVisibleItemBounds when items.length is 0 #68

Closed akre54 closed 6 years ago

akre54 commented 6 years ago

VirtualList.js#54 compares firstItemIndex vs its previous value. If any of the arguments passed to getVisibleItemBounds are undefined (or more critically, if items.length is 0), this check will be a TypeError. This change fixes this.

There should also probably be a test for this.

akre54 commented 6 years ago

Also #66 would fix this (returning early if state is undefined