Fix loadFromJSON 404s breaking fabric (Pattern)

Prevent image 404s in patterns from loadFromJSON from breaking
everything trying to get attributes of a source which is null, while
passing it upwards to allow dealing with images which failed to load
outside of Fabric.JS
This commit is contained in:
Max Kaplan 2014-03-07 00:19:35 -05:00
parent eb919f9a04
commit f2943ef2bb

View file

@ -137,6 +137,11 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
? this.source()
: this.source;
// if the image failed to load, return, and allow rest to continue loading
if (!source){
return '';
}
// if an image
if (typeof source.src !== 'undefined') {
if (!source.complete) {