fix console.error crash (#532)

This commit is contained in:
Mr.tang 2018-02-08 16:40:21 -06:00 committed by Cassie Tarakajian
parent 6faf52f61e
commit 193b15e074

View file

@ -187,10 +187,12 @@ class Editor extends React.Component {
if (this.props.runtimeErrorWarningVisible) {
this.props.consoleEvents.forEach((consoleEvent) => {
if (consoleEvent.method === 'error') {
if (consoleEvent.arguments.indexOf(')') > -1) {
const n = consoleEvent.arguments.replace(')', '').split(' ');
const lineNumber = parseInt(n[n.length - 1], 10) - 1;
this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error');
}
}
});
}
}