From da8c245516590ebb30d710158843c1b5d1e6832a Mon Sep 17 00:00:00 2001 From: Igor Emets Date: Wed, 8 May 2019 14:38:27 +0300 Subject: [PATCH] Fixing #2668, add null-checks in on_outro callback for IfBlock --- src/compile/render-dom/wrappers/IfBlock.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compile/render-dom/wrappers/IfBlock.ts b/src/compile/render-dom/wrappers/IfBlock.ts index f3b5c7f2b2..7b0d655a00 100644 --- a/src/compile/render-dom/wrappers/IfBlock.ts +++ b/src/compile/render-dom/wrappers/IfBlock.ts @@ -319,6 +319,9 @@ export default class IfBlockWrapper extends Wrapper { const destroy_old_block = deindent` @group_outros(); @on_outro(() => { + if (${if_blocks}[${previous_block_index}] === null) { + return; + } ${if_blocks}[${previous_block_index}].d(1); ${if_blocks}[${previous_block_index}] = null; }); @@ -430,6 +433,9 @@ export default class IfBlockWrapper extends Wrapper { ? deindent` @group_outros(); @on_outro(() => { + if (${name} === null) { + return; + } ${name}.d(1); ${name} = null; });