Skip to content

Commit 1c4117f

Browse files
author
Lauren McCarthy
committed
fixes #1163
1 parent c9f074b commit 1c4117f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/image/pixels.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ p5.prototype.set = function (x, y, imgOrCol) {
544544
* </div>
545545
*/
546546
p5.prototype.updatePixels = function (x, y, w, h) {
547+
// graceful fail - if loadPixels() or set() has not been called, pixel
548+
// array will be empty, ignore call to updatePixels()
549+
if (this.pixels.length === 0) {
550+
return;
551+
}
547552
this._renderer.updatePixels(x, y, w, h);
548553
};
549554

0 commit comments

Comments
 (0)