Skip to content

Commit

Permalink
Merge pull request #5 from benpetty/master
Browse files Browse the repository at this point in the history
Add catch for if domElement.contentDocument is null
  • Loading branch information
nickuraltsev authored Jul 12, 2018
2 parents 06f50ae + 94b898c commit 4e1f891
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ResizeDetector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ export default class ResizeDetector extends Component {
}

componentWillUnmount() {
this.domElement.contentDocument.defaultView.removeEventListener(
'resize',
this.props.onResize
);
if (this.domElement.contentDocument) {
this.domElement.contentDocument.defaultView.removeEventListener(
'resize',
this.props.onResize
);
}
}

setDOMElement(domElement) {
Expand Down

0 comments on commit 4e1f891

Please sign in to comment.