Skip to content

Commit

Permalink
Merge pull request #678 from gotson/fix/gh626-missing-toc
Browse files Browse the repository at this point in the history
prevent error when toc is not defined in the publication
  • Loading branch information
aferditamuriqi authored Jan 31, 2024
2 parents 293f01e + 2cca9f6 commit 87c1123
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/model/Publication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Publication extends R2Publication {
if (this.sample?.isSampleRead && this.positions?.length > 0) {
return this.limitedTOC();
}
return this.TOC;
return this.TOC || [];
}

private limitedTOC() {
Expand All @@ -74,7 +74,7 @@ export class Publication extends R2Publication {
}
}

let toc = this.TOC.map((item) => {
let toc = this.TOC?.map((item) => {
if (item.Href) {
const positions = this.positionsByHref(this.getRelativeHref(item.Href));
if (positions?.length > 0) {
Expand All @@ -98,7 +98,7 @@ export class Publication extends R2Publication {
}
return item;
});
return toc;
return toc || [];
}

get landmarks() {
Expand Down

0 comments on commit 87c1123

Please sign in to comment.