Skip to content

Commit ac765a1

Browse files
committed
Check availability of ref.
1 parent 72d1c63 commit ac765a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class MonacoEditor extends React.Component {
112112
const { language, theme, options } = this.props;
113113
const containerElement = this.refs.container; // eslint-disable-line react/no-string-refs
114114
const context = this.props.context || window;
115-
if (typeof context.monaco !== 'undefined') {
115+
if (containerElement && typeof context.monaco !== 'undefined') {
116116
// Before initializing monaco editor
117117
this.editorWillMount(context.monaco);
118118
this.editor = context.monaco.editor.create(containerElement, {

0 commit comments

Comments
 (0)