« get me outta code hell

Don't crash when passing playlists - 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-09-15 15:47:48 -0300
committerFlorrie <towerofnix@gmail.com>2018-09-15 15:47:49 -0300
commitd046cf893c1869cd529025808f4c089f6b7dfa94 (patch)
tree5febc944eaf78402b1fdab28a6908d972aa6a7ba
parent9e1384ee97d24673d151bd39778eba5273a94f3a (diff)
Don't crash when passing playlists
This happened when the openPlaylistDialog was closed before being
opened - Dialog.close would try to select(this.oldSelectedElement),
but of course that would be undefined since the dialog had never been
opened in the first place.
-rw-r--r--ui.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui.js b/ui.js
index 755d95f..aaa877a 100644
--- a/ui.js
+++ b/ui.js
@@ -231,7 +231,10 @@ class AppElement extends FocusElement {
   }
 
   async handlePlaylistSource(source, newTab = false) {
-    this.openPlaylistDialog.close()
+    if (this.openPlaylistDialog.visible) {
+      this.openPlaylistDialog.close()
+    }
+
     this.alertDialog.showMessage('Opening playlist...', false)
 
     let grouplike