From 66c091cfbbc7a8118b11c9c10dca1d8921b70e59 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 30 Jan 2018 08:24:49 -0800 Subject: [PATCH] Closes #538 Seems simple and obvious because it is, we should check that startBlock exists before using it --- .../Editor/components/Toolbar/components/LinkToolbar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/components/Editor/components/Toolbar/components/LinkToolbar.js b/app/components/Editor/components/Toolbar/components/LinkToolbar.js index efce54e3b..90e236ab2 100644 --- a/app/components/Editor/components/Toolbar/components/LinkToolbar.js +++ b/app/components/Editor/components/Toolbar/components/LinkToolbar.js @@ -138,7 +138,8 @@ class LinkToolbar extends Component { if (href) { change.setInline({ type: 'link', data: { href } }); } else if (link) { - const selContainsLink = !!change.value.startBlock.getChild(link.key); + const startBlock = change.value.startBlock; + const selContainsLink = !!(startBlock && startBlock.getChild(link.key)); if (selContainsLink) change.unwrapInlineByKey(link.key); } change.deselect();