Skip to content

Commit 3f64ec7

Browse files
committed
Fixed OT not handle when selection is empty
1 parent 53f26a7 commit 3f64ec7

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

public/vendor/ot/codemirror-adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ ot.CodeMirrorAdapter = (function (global) {
247247

248248
CodeMirrorAdapter.prototype.setSelection = function (selection) {
249249
var ranges = [];
250-
for (var i = 0; i < selection.ranges.length; i++) {
250+
for (var i = 0; selection && i < selection.ranges.length; i++) {
251251
var range = selection.ranges[i];
252252
ranges[i] = {
253253
anchor: this.cm.posFromIndex(range.anchor),

0 commit comments

Comments
 (0)