We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd88750 commit 45da5f7Copy full SHA for 45da5f7
1 file changed
pxtblocks/fields/field_animation.ts
@@ -235,8 +235,12 @@ export class FieldAnimationEditor extends FieldAssetEditor<FieldAnimationOptions
235
236
onDispose() {
237
super.onDispose();
238
- (this.sourceBlock_ as Blockly.BlockSvg).getSvgRoot().removeEventListener("mouseenter", this.onMouseEnter);
239
- (this.sourceBlock_ as Blockly.BlockSvg).getSvgRoot().removeEventListener("mouseleave", this.cancelAnimation);
+
+ const root = (this.sourceBlock_ as Blockly.BlockSvg)?.getSvgRoot();
240
+ if (root) {
241
+ root.removeEventListener("mouseenter", this.onMouseEnter);
242
+ root.removeEventListener("mouseleave", this.cancelAnimation);
243
+ }
244
document.removeEventListener("mousemove", this.onDocumentMouseMove);
245
}
246
0 commit comments