« get me outta code hell

Fix error on quit without ever opening text editor - 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-10-23 14:06:58 -0300
committerFlorrie <towerofnix@gmail.com>2019-10-23 14:06:58 -0300
commitd9512b8a4a7c96adc1aafa101c1741a6e065b421 (patch)
treeec19a1d23708122bec64cc3e44d86b8549dfd221
parent147172fe720f8af8a219ba384c0407ca751e0321 (diff)
Fix error on quit without ever opening text editor
-rw-r--r--ui.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index cfb3e87..60d9050 100644
--- a/ui.js
+++ b/ui.js
@@ -4023,6 +4023,10 @@ class NotesTextEditor extends TuiTextEditor {
   }
 
   async save() {
+    if (!this.openedItem || !this.openedPath) {
+      return
+    }
+
     const text = this.getSourceText()
     try {
       await writeFile(this.openedPath, text)