Skip to content

Commit

Permalink
Error if style is null (#4781)
Browse files Browse the repository at this point in the history
I tested in Chrome and when style(line 50) is null, style.toString is undefined
Reason: typeof null equals "object" (at least in Chrome)
  • Loading branch information
Rydori authored and etimberg committed Sep 29, 2017
1 parent 8a4ac1e commit b94532c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/helpers.canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b94532c

Please sign in to comment.