Skip to content

Commit

Permalink
fix tunebook via direct URL
Browse files Browse the repository at this point in the history
  • Loading branch information
hwellmann committed Aug 14, 2023
1 parent e86177f commit 6bce3c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/app/component/tunes-list/tunes-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export class TunesListComponent {
}

bookName(): string {
return this.index.getBookById(this.bookId).descriptor.name;
return this.index.getBookById(this.bookId)?.descriptor.name;
}

private onReady(event?: string) {
this.entries = this.index.findAllTunesInBook(event);
if (event == this.bookId) {
this.entries = this.index.findAllTunesInBook(event);
}
}
}
2 changes: 1 addition & 1 deletion src/app/service/tunebook-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class TuneBookIndex {
}

findAllTunesInBook(bookId: string): AnalyzedTune[] {
return this.idToBookMap.get(bookId).tuneBook.tunes;
return this.idToBookMap.get(bookId)?.tuneBook.tunes;
}

getBooks(): TuneBookReference[] {
Expand Down

0 comments on commit 6bce3c0

Please sign in to comment.