« get me outta code hell

Fix input causing misc. crashes before 100% loaded - 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>2019-04-19 14:59:49 -0300
committerFlorrie <towerofnix@gmail.com>2019-04-19 14:59:49 -0300
commitc6e47054472b809703569890fb2745d4f2cda3d1 (patch)
treee1a6caf1243598dbd655c62e776911916663612b
parent8feefa78118cdfe9a98198786a0315053dc098a1 (diff)
Fix input causing misc. crashes before 100% loaded
Definitely by pressing Ctrl-L but probably any of these would cause all
sorts of badness.
-rw-r--r--ui.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 049930b..e29fb2c 100644
--- a/ui.js
+++ b/ui.js
@@ -1153,6 +1153,12 @@ class GrouplikeListingElement extends Form {
   }
 
   keyPressed(keyBuf) {
+    // Just about everything here depends on the grouplike existing, so let's
+    // not continue if it doesn't!
+    if (!this.grouplike) {
+      return
+    }
+
     if (telc.isBackspace(keyBuf)) {
       this.loadParentGrouplike()
     } else if (telc.isCharacter(keyBuf, '/') || keyBuf[0] === 6) { // '/', ctrl-F