Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if style is null (Bugfix) #4781

Merged
merged 1 commit into from
Sep 29, 2017
Merged

Error if style is null (Bugfix) #4781

merged 1 commit into from
Sep 29, 2017

Conversation

Rydori
Copy link
Contributor

@Rydori Rydori commented Sep 20, 2017

I tested in Chrome and when style(line 50) is null, style.toString is undefined
Reason: typeof null equals "object" (at least in Chrome)

I tested in Chrome and when style(line 50) is null, style.toString is undefined
Reason: typeof null equals "object" (at least in Chrome)
@Rydori
Copy link
Contributor Author

Rydori commented Sep 21, 2017

should do the same :)

@@ -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') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (helpers.isObject(style))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, helpers.isObject doesn't work in this case since it returns true only for plain object.

@simonbrunel simonbrunel added this to the Version 2.7.1 milestone Sep 22, 2017
@Rydori
Copy link
Contributor Author

Rydori commented Sep 22, 2017

Console (Chrome V8):
var t = document.createElement("div")

undefined
Object.prototype.toString.call(t)
"[object HTMLDivElement]"
typeof t
"object"

@Rydori
Copy link
Contributor Author

Rydori commented Sep 22, 2017

im so sry, can you revert the second change from this request

@simonbrunel
Copy link
Member

My fault, helpers.isObject doesn't work here, please push a new commit reverting to your initial proposal: if (style && typeof style === 'object')

@Rydori
Copy link
Contributor Author

Rydori commented Sep 22, 2017

i reverted the change also in my repo

Copy link
Member

@simonbrunel simonbrunel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@etimberg etimberg merged commit b94532c into chartjs:master Sep 29, 2017
yofreke pushed a commit to yofreke/Chart.js that referenced this pull request Dec 30, 2017
I tested in Chrome and when style(line 50) is null, style.toString is undefined
Reason: typeof null equals "object" (at least in Chrome)
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
I tested in Chrome and when style(line 50) is null, style.toString is undefined
Reason: typeof null equals "object" (at least in Chrome)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants