diff --git a/core/mutator.js b/core/mutator.js index fc9391d3684..08b36533e2b 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -366,8 +366,10 @@ class Mutator extends Icon { if (this.block_.saveConnections) { const thisRootBlock = this.rootBlock_; this.block_.saveConnections(thisRootBlock); - this.sourceListener_ = function() { - this.block_.saveConnections(thisRootBlock); + this.sourceListener_ = () => { + if (this.block_) { + this.block_.saveConnections(thisRootBlock); + } }; this.block_.workspace.addChangeListener(this.sourceListener_); }