Fixed OT not handle when selection is empty

This commit is contained in:
Wu Cheng-Han 2015-10-05 14:32:31 +08:00
parent 53f26a7771
commit 3f64ec79b7
2 changed files with 2 additions and 2 deletions

View file

@ -247,7 +247,7 @@ ot.CodeMirrorAdapter = (function (global) {
CodeMirrorAdapter.prototype.setSelection = function (selection) { CodeMirrorAdapter.prototype.setSelection = function (selection) {
var ranges = []; var ranges = [];
for (var i = 0; i < selection.ranges.length; i++) { for (var i = 0; selection && i < selection.ranges.length; i++) {
var range = selection.ranges[i]; var range = selection.ranges[i];
ranges[i] = { ranges[i] = {
anchor: this.cm.posFromIndex(range.anchor), anchor: this.cm.posFromIndex(range.anchor),

File diff suppressed because one or more lines are too long