diff --git a/lib/minimap-element.js b/lib/minimap-element.js index 41bc7f70..7d23b4e3 100644 --- a/lib/minimap-element.js +++ b/lib/minimap-element.js @@ -1216,6 +1216,8 @@ export default class MinimapElement { } let update = () => { + if (!this.minimap) { return } + let passed = this.getTime() - start if (duration === 0) { progress = 1 diff --git a/spec/minimap-element-spec.js b/spec/minimap-element-spec.js index ef7aa49a..9417e399 100644 --- a/spec/minimap-element-spec.js +++ b/spec/minimap-element-spec.js @@ -566,6 +566,14 @@ describe('MinimapElement', () => { return editorElement.getScrollTop() >= 380 }) }) + + it('stops the animation if the text editor is destroyed', () => { + editor.destroy() + + nextAnimationFrame !== noAnimationFrame && nextAnimationFrame() + + expect(nextAnimationFrame === noAnimationFrame) + }) }) describe('dragging the visible area', () => {