fix: add null check in dispose method (#675)

This commit is contained in:
William Boman 2018-10-18 13:12:14 +02:00 committed by Roman Hotsiy
parent 7df471b69d
commit 6b7c5b7df3

View File

@ -1,4 +1,4 @@
import { observe } from 'mobx'; import { observe, Lambda } from 'mobx';
import { OpenAPISpec } from '../types'; import { OpenAPISpec } from '../types';
import { loadAndBundleSpec } from '../utils/loadAndBundleSpec'; import { loadAndBundleSpec } from '../utils/loadAndBundleSpec';
@ -58,7 +58,7 @@ export class AppStore {
marker = new MarkerService(); marker = new MarkerService();
private scroll: ScrollService; private scroll: ScrollService;
private disposer; private disposer: Lambda | null = null;
constructor( constructor(
spec: OpenAPISpec, spec: OpenAPISpec,
@ -96,7 +96,9 @@ export class AppStore {
dispose() { dispose() {
this.scroll.dispose(); this.scroll.dispose();
this.menu.dispose(); this.menu.dispose();
this.disposer(); if (this.disposer != null) {
this.disposer();
}
} }
/** /**