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
Expected behavior
clearCanvas()
fromhelpers.canvas.ts
should only callgetContext()
on valid truth-yctx
values.Current behavior
Closes #11743
Reproducible sample
https://github.com/chartjs/Chart.js/issues/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