Skip to content

Commit

Permalink
fix: don't try to encode SVG if there's no body
Browse files Browse the repository at this point in the history
Fixes #95
  • Loading branch information
remy committed Apr 19, 2016
1 parent 7459b98 commit e5b35fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/image.js
Expand Up @@ -18,7 +18,8 @@ function image(url) {
debug('image loaded: %s', url);

// if the url is SVG, let's compress and use the XML directly
if (mime.lookup(url) === 'image/svg+xml' && !inliner.options.nosvg) {
if (res.body && mime.lookup(url) === 'image/svg+xml' &&
!inliner.options.nosvg) {
return new Promise(function (resolve, reject) {
svgo.optimize(res.body.toString(), function (result) {
debug('optimising svg');
Expand Down

0 comments on commit e5b35fe

Please sign in to comment.