diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index 09aeba43..e7b6bdce 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -192,10 +192,15 @@ class Editor extends React.Component { if (this.props.runtimeErrorWarningVisible && this._cm.getDoc().modeOption === 'javascript') { this.props.consoleEvents.forEach((consoleEvent) => { if (consoleEvent.method === 'error') { - if (consoleEvent.data[0].indexOf(')') > -1) { + if (consoleEvent.data && + consoleEvent.data[0] && + consoleEvent.data[0].indexOf && + consoleEvent.data[0].indexOf(')') > -1) { const n = consoleEvent.data[0].replace(')', '').split(' '); const lineNumber = parseInt(n[n.length - 1], 10) - 1; - this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error'); + if (!Number.isNaN(lineNumber)) { + this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error'); + } } } });