« get me outta code hell

If first track, lastTrack is null - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2017-09-02 10:28:07 -0300
committerFlorrie <towerofnix@gmail.com>2017-09-02 10:28:07 -0300
commit1bf436eecf2a04e7df1b2a6a720d6ac1712bc0bb (patch)
tree2feb71eae8befe799d60fa0c41912e2fbe20704f /src
parentea6249b614a281438638777ed58d7a2c8ecab679 (diff)
If first track, lastTrack is null
Diffstat (limited to 'src')
-rw-r--r--src/pickers2.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pickers2.js b/src/pickers2.js
index 53b76a8..81617a9 100644
--- a/src/pickers2.js
+++ b/src/pickers2.js
@@ -27,7 +27,7 @@ class HistoryManager {
 
   addNextTrackToTimeline(picker) {
     const lastTrack = this.timeline[this.timeline.length - 1]
-    this.timeline.push(this.picker(lastTrack))
+    this.timeline.push(this.picker(lastTrack || null))
   }
 
   fillTimeline() {
@@ -68,7 +68,7 @@ const createOrderedPicker = playlist => {
 
   return lastTrack => {
     if (lastTrack === null) {
-      return flattened[0]
+      return flattened.items[0]
     }
 
     const index = flattened.items.indexOf(lastTrack)