« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 02c77bb..8e235a0 100644
--- a/ui.js
+++ b/ui.js
@@ -252,6 +252,10 @@ class AppElement extends FocusElement {
   }
 
   playNextTrack(track) {
+    if (!track) {
+      return
+    }
+
     const queue = this.queueGrouplike
     let queueIndex = queue.items.indexOf(track)
     if (queueIndex === -1) {
@@ -277,6 +281,10 @@ class AppElement extends FocusElement {
   }
 
   playPreviousTrack(track) {
+    if (!track) {
+      return
+    }
+
     const queue = this.queueGrouplike
     let queueIndex = queue.items.indexOf(track)
     if (queueIndex === -1) {