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 authored and xiaody committed Oct 7, 2023
1 parent bf5cc8e commit e225807
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.jsx
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 e225807

Please sign in to comment.