« get me outta code hell

Fix referencing groupTrackIndex when it doesn't exist - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-04-08 21:03:38 -0300
committerFlorrie <towerofnix@gmail.com>2018-04-08 21:03:38 -0300
commit3c816f3c8af0b595f384f5f9377431a46b1141b2 (patch)
tree346f14ed36bfb189232397e1d35c61f5e6820139
parent372cd36afdf6f489b00fb23893a480819883886a (diff)
Fix referencing groupTrackIndex when it doesn't exist
-rw-r--r--src/loop-play.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/loop-play.js b/src/loop-play.js
index ad071c3..f01ee5f 100644
--- a/src/loop-play.js
+++ b/src/loop-play.js
@@ -452,11 +452,13 @@ class PlayController extends EventEmitter {
         }
       }
 
+      const groupIndexArr = (track && track.groupTrackIndex) || ['', '']
+
       fullStatusLine += processTemplateString(statusLineTemplate, Object.assign({
         index: track ? (track.overallTrackIndex[0] + 1) : '',
         trackCount: track ? (track.overallTrackIndex[1]) : '',
-        indexGroup: track ? (track.groupTrackIndex[0] + 1) : '',
-        trackCountGroup: track ? (track.groupTrackIndex[1]) : '',
+        indexGroup: groupIndexArr[0],
+        trackCountGroup: groupIndexArr[1],
         longIndex
       }, playerData))