Skip to content

Commit

Permalink
catch crashes of fetch when loading image
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanIrache committed Mar 18, 2021
1 parent 9d12b8c commit 5fa7ca9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/image/loading_displaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,14 @@ p5.prototype.loadImage = function(path, successCallback, failureCallback) {
img.src = path;
}
pImg.modified = true;
});
}).catch(e => {
p5._friendlyFileLoadError(0, path);
if (typeof failureCallback === 'function') {
failureCallback(e);
} else {
console.error(e);
}
})
return pImg;
};

Expand Down

0 comments on commit 5fa7ca9

Please sign in to comment.