diff --git a/CHANGELOG.md b/CHANGELOG.md index 52f66779b..15ecaab7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ project adheres to [Semantic Versioning](http://semver.org/). ================== ### Changed ### Added + +- added a try and catch block in lib/image.js in the setSource function, to prevent unexpected crashing, if an 'Unsupported image type' is provided. + ### Fixed 3.0.0 diff --git a/lib/image.js b/lib/image.js index 4a37849ee..0fd67e99f 100644 --- a/lib/image.js +++ b/lib/image.js @@ -91,6 +91,11 @@ function getSource (img) { } function setSource (img, src, origSrc) { - SetSource.call(img, src) - img._originalSource = origSrc + try { + SetSource.call(img, src) + img._originalSource = origSrc + } catch (err) { + img._originalSource = null + throw err + } }