« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 1fc74520..80397065 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -53,7 +53,7 @@ export function write(album, {wikiData}) {
   const displayTrackGroups =
     album.trackGroups &&
       (album.trackGroups.length > 1 ||
-        !album.trackGroups[0].isDefaultTrackGroup);
+        !album.trackGroups[0]?.isDefaultTrackGroup);
 
   const listTag = getAlbumListTag(album);
 
@@ -301,6 +301,7 @@ export function write(album, {wikiData}) {
                 })),
 
             displayTrackGroups &&
+            !empty(album.trackGroups) &&
               html.tag('dl',
                 {class: 'album-group-list'},
                 album.trackGroups.flatMap(({
@@ -323,6 +324,7 @@ export function write(album, {wikiData}) {
                 ])),
 
             !displayTrackGroups &&
+            !empty(album.tracks) &&
               html.tag(listTag,
                 album.tracks.map(trackToListItem)),
 
@@ -759,6 +761,10 @@ export function generateAlbumNavLinks(album, currentTrack, {
     randomLink,
   ].filter(Boolean);
 
+  if (empty(allLinks)) {
+    return '';
+  }
+
   return `(${language.formatUnitList(allLinks)})`;
 }