Skip to content

Commit

Permalink
fix(annotator): Fail silently if annotator destroy call fails (#1215)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
jstoffan and mergify[bot] authored May 29, 2020
1 parent 699e859 commit 841cd5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/viewers/BaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,12 @@ class BaseViewer extends EventEmitter {

// Destroy the annotator
if (this.annotator && typeof this.annotator.destroy === 'function') {
this.annotator.removeAllListeners();
this.annotator.destroy();
try {
this.annotator.removeAllListeners();
this.annotator.destroy();
} catch (error) {
// No-op, as annotator was likely never initialized in the first place
}
}

this.destroyed = true;
Expand Down

0 comments on commit 841cd5a

Please sign in to comment.