]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Error if style is null (#4781)
authorRydori <daniel.siegert@udo.edu>
Fri, 29 Sep 2017 11:30:41 +0000 (13:30 +0200)
committerEvert Timberg <evert.timberg+github@gmail.com>
Fri, 29 Sep 2017 11:30:41 +0000 (13:30 +0200)
I tested in Chrome and when style(line 50) is null, style.toString is undefined
Reason: typeof null equals "object" (at least in Chrome)

src/helpers/helpers.canvas.js

index 1429a31e6e06de9f2c54907496f7e1b13fd45f44..13b110268b92687ca8ad428786148c0e1707f643 100644 (file)
@@ -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);