mapbox / spritezero

small opinionated sprites
Other
173 stars 62 forks source link

Produce an empty layout result for svg without width or height attributes #69

Closed jseppi closed 4 years ago

jseppi commented 4 years ago

If an input SVG is missing width or height attributes, mapnik.fromSVGBytes will result in an error, which in turn makes generateLayout and generateImage fail.

This PR adds error-handling logic for this situation to instead callback with a null result, allowing the other layout sprite or image result to still be produced with the remaining "good" SVGs.

This is essentially an addendum to https://github.com/mapbox/spritezero/pull/62.

cc @aparlato @samanpwbb