Skip to content

Commit 3855af1

Browse files
andremejerairrest
andcommitted
Prevent error in destroyChart when chartInstance does not exist (#453)
* Prevent error in destroyChart when chartInstance does not exist * Update src/index.js Co-Authored-By: Jeremy Ayerst <[email protected]> Co-authored-by: Jeremy Ayerst <[email protected]>
1 parent 5e72d80 commit 3855af1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ class ChartComponent extends React.Component {
255255
}
256256

257257
destroyChart() {
258+
if (!this.chartInstance) {
259+
return;
260+
}
261+
258262
// Put all of the datasets that have existed in the chart back on the chart
259263
// so that the metadata associated with this chart get destroyed.
260264
// This allows the datasets to be used in another chart. This can happen,

0 commit comments

Comments
 (0)