Skip to content

Commit 259393e

Browse files
author
unknown
committed
Added check for line number for error reporting
1 parent 682f708 commit 259393e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

javascript-console-share/src/main/amp/web/fme/components/jsconsole/javascript-console.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,11 +1415,13 @@ if (typeof String.prototype.startsWith != 'function') {
14151415
if(this.widgets.codeMirrorScript.somethingSelected()){
14161416
line = line + this.widgets.codeMirrorScript.getCursor().line-1;
14171417
}
1418-
var selectionEnd = this.widgets.codeMirrorScript.getLineHandle(line).text.length;
1419-
var from={"line":line,"ch":0};
1420-
var to={"line":line,"ch":selectionEnd};
1421-
this.widgets.codeMirrorScript.markText(from,to,{clearOnEnter:"true",className: "CodeMirror-lint-mark-error", __annotation: {from:from, to:to, severity:"error", message:result.callstack[1]}});
1422-
1418+
var handle = this.widgets.codeMirrorScript.getLineHandle(line);
1419+
if (handle) {
1420+
var selectionEnd = handle.text.length;
1421+
var from={"line":line,"ch":0};
1422+
var to={"line":line,"ch":selectionEnd};
1423+
this.widgets.codeMirrorScript.markText(from,to,{clearOnEnter:"true",className: "CodeMirror-lint-mark-error", __annotation: {from:from, to:to, severity:"error", message:result.callstack[1]}});
1424+
}
14231425
}
14241426
},
14251427

0 commit comments

Comments
 (0)