1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-01 05:16:10 +01:00

Avoid crash in updateSelection() in content when window.getSelection() returns null (#2163)

This commit is contained in:
Damien Erambert 2018-09-17 18:27:10 -07:00 committed by Ian Storm Taylor
parent dbf35f2565
commit 222f746e85

View File

@ -144,6 +144,11 @@ class Content extends React.Component {
const { isBackward } = selection
const window = getWindow(this.element)
const native = window.getSelection()
// .getSelection() can return null in some cases
// https://bugzilla.mozilla.org/show_bug.cgi?id=827585
if (!native) return
const { rangeCount, anchorNode } = native
// If both selections are blurred, do nothing.