diff --git a/src/component/base/DraftEditor.react.js b/src/component/base/DraftEditor.react.js index 41680dc..430ae31 100644 --- a/src/component/base/DraftEditor.react.js +++ b/src/component/base/DraftEditor.react.js @@ -368,6 +368,12 @@ class DraftEditor extends React.Component { const alreadyHasFocus = editorState.getSelection().getHasFocus(); const editorNode = ReactDOM.findDOMNode(this.refs.editor); + if (!editorNode) { + // once in a while people call 'focus' in a setTimeout, and the node has + // been deleted, so it can be null in that case. + return; + } + const scrollParent = Style.getScrollParent(editorNode); const {x, y} = scrollPosition || getScrollPosition(scrollParent);