« get me outta code hell

Don't crash when an empty group is played - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-03 11:21:31 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-03 11:21:31 -0300
commit2144ade7eb41b9a7e90e4deff59ac5f6dfd256cc (patch)
tree03261d9c29cee2d443f0894d1f8dac3053736e91
parent20b9ffb594c5cea5b90b1aa07c91764610b70100 (diff)
Don't crash when an empty group is played
-rw-r--r--ui.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 1500ad7..970adbf 100644
--- a/ui.js
+++ b/ui.js
@@ -542,6 +542,11 @@ class AppElement extends FocusElement {
       item = flattenGrouplike(item).items[0]
     }
 
+    // If there is no item (e.g. an empty group), well.. don't do anything.
+    if (!item) {
+      return
+    }
+
     playTrack: {
       // No downloader argument? That's no good - stop here.
       // TODO: An error icon on this item, or something???