Skip to content

Commit

Permalink
fix: add null check in dispose method (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamboman authored and RomanHotsiy committed Oct 18, 2018
1 parent 7df471b commit 6b7c5b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/AppStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observe } from 'mobx';
import { observe, Lambda } from 'mobx';

import { OpenAPISpec } from '../types';
import { loadAndBundleSpec } from '../utils/loadAndBundleSpec';
Expand Down Expand Up @@ -58,7 +58,7 @@ export class AppStore {
marker = new MarkerService();

private scroll: ScrollService;
private disposer;
private disposer: Lambda | null = null;

constructor(
spec: OpenAPISpec,
Expand Down Expand Up @@ -96,7 +96,9 @@ export class AppStore {
dispose() {
this.scroll.dispose();
this.menu.dispose();
this.disposer();
if (this.disposer != null) {
this.disposer();
}
}

/**
Expand Down

0 comments on commit 6b7c5b7

Please sign in to comment.