From b2e0612149c95f855b7529a2fdcae45cc52df6ab Mon Sep 17 00:00:00 2001
From: Conor Cussell <conorcussell@users.noreply.github.com>
Date: Mon, 11 Dec 2017 15:54:46 +0100
Subject: [PATCH] Deal with invalid range passed to getSelectionIndexes (#1443)

* Deal with invalid range in getSelectionIndexes

* Use range is unset
---
 packages/slate/src/models/node.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packages/slate/src/models/node.js b/packages/slate/src/models/node.js
index b24e4a9cd7..81ea17f73b 100644
--- a/packages/slate/src/models/node.js
+++ b/packages/slate/src/models/node.js
@@ -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) {