Skip to content

Commit

Permalink
Deal with invalid range passed to getSelectionIndexes (#1443)
Browse files Browse the repository at this point in the history
* Deal with invalid range in getSelectionIndexes

* Use range is unset
  • Loading branch information
conorcussell authored and ianstormtaylor committed Dec 11, 2017
1 parent cef33de commit b2e0612
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/slate/src/models/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,11 @@ class Node {
return null
}

// if we've been given an invalid selection we can exit early.
if (range.isUnset) {
return null
}

// PERF: if the start and end keys are the same, just check for the child
// that contains that single key.
if (startKey == endKey) {
Expand Down

0 comments on commit b2e0612

Please sign in to comment.