« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page/album.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/page/album.js')
-rw-r--r--src/page/album.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/page/album.js b/src/page/album.js
index 7a7f35bc..897e5110 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -55,7 +55,7 @@ export function write(album, {wikiData}) {
   const displayTrackSections =
     album.trackSections &&
       (album.trackSections.length > 1 ||
-        !album.trackSections[0].isDefaultTrackSection);
+        !album.trackSections[0]?.isDefaultTrackSection);
 
   const listTag = getAlbumListTag(album);
 
@@ -294,6 +294,7 @@ export function write(album, {wikiData}) {
                 })),
 
             displayTrackSections &&
+            !empty(album.trackSections) &&
               html.tag('dl',
                 {class: 'album-group-list'},
                 album.trackSections.flatMap(({
@@ -316,6 +317,7 @@ export function write(album, {wikiData}) {
                 ])),
 
             !displayTrackSections &&
+            !empty(album.tracks) &&
               html.tag(listTag,
                 album.tracks.map(trackToListItem)),
 
@@ -749,6 +751,10 @@ export function generateAlbumNavLinks(album, currentTrack, {
     randomLink,
   ].filter(Boolean);
 
+  if (empty(allLinks)) {
+    return '';
+  }
+
   return `(${language.formatUnitList(allLinks)})`;
 }