Skip to content

Commit

Permalink
fix: Prevent crash when this.canvas is null in the componentWillUnmou…
Browse files Browse the repository at this point in the history
…nt method
  • Loading branch information
zigcccc committed Sep 28, 2023
1 parent 1762037 commit ef92eea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ class LinesEllipsis extends React.Component {
}

componentWillUnmount () {
this.canvas.parentNode.removeChild(this.canvas)
this.canvas = null
if (this.canvas) {
this.canvas.parentNode.removeChild(this.canvas)
this.canvas = null
}
}

setState (state, callback) {
Expand Down

0 comments on commit ef92eea

Please sign in to comment.