From 193b15e0744cf4c75173a400cfa2a74b13e7e48b Mon Sep 17 00:00:00 2001 From: "Mr.tang" <1074461480@qq.com> Date: Thu, 8 Feb 2018 16:40:21 -0600 Subject: [PATCH] fix console.error crash (#532) --- client/modules/IDE/components/Editor.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index e183767c..b8088996 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -187,9 +187,11 @@ class Editor extends React.Component { if (this.props.runtimeErrorWarningVisible) { this.props.consoleEvents.forEach((consoleEvent) => { if (consoleEvent.method === 'error') { - const n = consoleEvent.arguments.replace(')', '').split(' '); - const lineNumber = parseInt(n[n.length - 1], 10) - 1; - this._cm.addLineClass(lineNumber, 'background', 'line-runtime-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'); + } } }); }