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

do not attempt to clear canvas if one does not exist #11764

Merged
merged 4 commits into from
May 17, 2024

Conversation

DAcodedBEAT
Copy link
Contributor

Expected behavior

clearCanvas() from helpers.canvas.ts should only call getContext() on valid truth-y ctx values.

Current behavior

helpers.canvas.js:119 Uncaught TypeError: Cannot read properties of null (reading 'getContext')
    at clearCanvas (helpers.canvas.js:119:23)
    at Chart.clear (core.controller.js:268:5)
    at Chart.draw (core.controller.js:718:10)
    at core.animator.js:89:15
    at Map.forEach (<anonymous>)
    at Animator._update (core.animator.js:60:18)
    at core.animator.js:45:12

Closes #11743

Reproducible sample

#11743

Optional extra steps/info to reproduce

No response

Context

.

chart.js version

4.4.2

Browser name and version

experienced on multiple browsers

Link to your project

No response

etimberg
etimberg previously approved these changes May 7, 2024
@LeeLenaleee LeeLenaleee added this to the 4.5.0 milestone May 16, 2024
@DAcodedBEAT
Copy link
Contributor Author

Thanks @LeeLenaleee , do you have an approximation for 4.5.0 being released?

@etimberg etimberg merged commit e7b8fa2 into chartjs:master May 17, 2024
8 checks passed
@LeeLenaleee
Copy link
Collaborator

I think we might be able to do a 4.4.3 release since there are only bug fixes soon

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.

Cannot read properties of null (reading 'getContext')
3 participants