mapbox / shp-write

create and write to shapefiles in pure javascript
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

bugfix(zip): fix check for feature type presence #42

Closed symbyte closed 7 years ago

symbyte commented 7 years ago

the geojson.line(features) call on a feature collection that does not contain any line features returns an empty array nested inside an array causing the l.geometries.length to always return true, which causes and attempt to pefrorm a write on an empty array of geometries, which causes the write call to never return, and thus keeps the zip function from finishing.

this is avoided by checking the length of the nested array instead.

fixes #43

tmcw commented 7 years ago

Added one comment about a guarantee that I'm not sure exists (whether l.geometries will have length of 1+ always) but otherwise looks great, and thanks so much for contributing a PR!

symbyte commented 7 years ago

Let me know if you want me to squash these commits down to one.

tmcw commented 7 years ago

👍 Thanks, the fancy new GitHub merge process will let me do that automatically :)

symbyte commented 7 years ago

Oh, nice! TIL.

symbyte commented 7 years ago

Any idea when this change can be released?