Skip to content

Commit

Permalink
[Issue #156] Fix null reference when context menu is not defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Mar 25, 2020
1 parent d55943b commit 5626121
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -111,9 +111,6 @@ export class ComicListComponent implements OnInit, OnDestroy {
private router: Router
) {
this.addContextMenuItems();
}

ngOnInit() {
this.contextMenuItemsSubscription = this.contextMenuAdaptor.items$.subscribe(
items => {
this.contextMenuItems = generateContextMenuItems(
Expand All @@ -124,7 +121,7 @@ export class ComicListComponent implements OnInit, OnDestroy {
);
this.mouseEventSubscription = this.contextMenuAdaptor.mouseEvent$.subscribe(
event => {
if (!!event) {
if (!!event && !!this.contextMenu) {
this.contextMenu.show(event);
}
}
Expand Down Expand Up @@ -167,6 +164,8 @@ export class ComicListComponent implements OnInit, OnDestroy {
this.readingListAdaptor.get_reading_lists();
}

ngOnInit() {}

ngOnDestroy() {
this.contextMenuItemsSubscription.unsubscribe();
this.mouseEventSubscription.unsubscribe();
Expand Down

0 comments on commit 5626121

Please sign in to comment.