From 6bce3c07e5de77106c9d138253c7899883ac44b0 Mon Sep 17 00:00:00 2001 From: Harald Wellmann Date: Mon, 14 Aug 2023 11:53:04 +0200 Subject: [PATCH] fix tunebook via direct URL --- src/app/component/tunes-list/tunes-list.component.ts | 6 ++++-- src/app/service/tunebook-index.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/component/tunes-list/tunes-list.component.ts b/src/app/component/tunes-list/tunes-list.component.ts index 45732e9..6a9e77f 100644 --- a/src/app/component/tunes-list/tunes-list.component.ts +++ b/src/app/component/tunes-list/tunes-list.component.ts @@ -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); + } } } diff --git a/src/app/service/tunebook-index.ts b/src/app/service/tunebook-index.ts index 9a99923..37af5a1 100644 --- a/src/app/service/tunebook-index.ts +++ b/src/app/service/tunebook-index.ts @@ -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[] {