fix: don't try to encode SVG if there's no body

Fixes #95
This commit is contained in:
Remy Sharp 2016-04-19 11:08:28 +01:00
parent 7459b98ef8
commit e5b35fe352

View File

@ -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');