« 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.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 970adbf..99039cf 100644
--- a/ui.js
+++ b/ui.js
@@ -1432,6 +1432,11 @@ class ContextMenu extends FocusElement {
   }
 
   show({x = 0, y = 0, items}) {
+    items = items.filter(Boolean)
+    if (!items.length) {
+      return
+    }
+
     // This *should* work with a menu action which opens the menu again,
     // because the selected element will be restored before the menu is
     // opened the second time.