From ee729622e0d1531a35becb7ffb13e287c325d7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 13 Apr 2014 18:11:34 +0200 Subject: [PATCH] Correctly handle Raster#setImage(null) --- src/item/Raster.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/item/Raster.js b/src/item/Raster.js index af85ecec..843b071c 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -193,7 +193,7 @@ var Raster = Item.extend(/** @lends Raster# */{ if (this._canvas) CanvasProvider.release(this._canvas); // Due to similarities, we can handle both canvas and image types here. - if (image.getContext) { + if (image && image.getContext) { // A canvas object this._image = null; this._canvas = image; @@ -207,8 +207,8 @@ var Raster = Item.extend(/** @lends Raster# */{ // apparently can have width / height set to 0 when the image is // invisible in the document. this._size = new Size( - image.naturalWidth || image.width, - image.naturalHeight || image.height); + image ? image.naturalWidth || image.width : 0, + image ? image.naturalHeight || image.height : 0); this._context = null; this._changed(/*#=*/ Change.GEOMETRY | /*#=*/ Change.PIXELS); },