From: Rydori Date: Fri, 29 Sep 2017 11:30:41 +0000 (+0200) Subject: Error if style is null (#4781) X-Git-Tag: v2.7.1~1^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b94532c29f7a4526e8c48961a1451e4ae1a9460c;p=thirdparty%2FChart.js.git Error if style is null (#4781) I tested in Chrome and when style(line 50) is null, style.toString is undefined Reason: typeof null equals "object" (at least in Chrome) --- diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index 1429a31e6..13b110268 100644 --- a/src/helpers/helpers.canvas.js +++ b/src/helpers/helpers.canvas.js @@ -47,7 +47,7 @@ var exports = module.exports = { drawPoint: function(ctx, style, radius, x, y) { var type, edgeLength, xOffset, yOffset, height, size; - if (typeof style === 'object') { + if (style && typeof style === 'object') { type = style.toString(); if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') { ctx.drawImage(style, x - style.width / 2, y - style.height / 2, style.width, style.height);