From d9c9b3d1a271496ee79bc398cdcbd4f0a6c1bbc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 14 Jan 2016 19:19:14 +0100 Subject: [PATCH] Fix exceptions when a top-level layer is selected. Getting the parent layer on a top-level layer returns null. --- src/item/Item.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index 4d5bdcf1..29887c79 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -4065,8 +4065,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ && this._isUpdated(updateVersion)) { // Allow definition of selected color on a per item and per // layer level, with a fallback to #009dec - var color = this.getSelectedColor(true) - || this.getLayer().getSelectedColor(true), + var layer, + color = this.getSelectedColor(true) + || (layer = this.getLayer()) && layer.getSelectedColor(true), mx = matrix.chain(this.getGlobalMatrix(true)); ctx.strokeStyle = ctx.fillStyle = color ? color.toCanvasStyle(ctx) : '#009dec';