Fix exceptions when a top-level layer is selected.

Getting the parent layer on a top-level layer returns null.
This commit is contained in:
Jürg Lehni 2016-01-14 19:19:14 +01:00
parent c5ec9ae0b9
commit d9c9b3d1a2

View file

@ -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';