From 6fbb1a29440520b8331f05ce75443888554a1644 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Mon, 30 Dec 2019 22:04:45 +0300 Subject: [PATCH] 1.22.34 --- modules/ui/notes-editor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ui/notes-editor.js b/modules/ui/notes-editor.js index dea88318..011a325c 100644 --- a/modules/ui/notes-editor.js +++ b/modules/ui/notes-editor.js @@ -2,9 +2,8 @@ function editNotes(id, name) { // update list of objects const select = document.getElementById("notesSelect"); - for (let i = select.options.length; i < notes.length; i++) { - select.options.add(new Option(notes[i].id, notes[i].id)); - } + select.options.length = 0; + for (const note of notes) {select.options.add(new Option(note.id, note.id));} // select an object if (notes.length) { @@ -47,6 +46,7 @@ function editNotes(id, name) { function changeObject() { const note = notes.find(note => note.id === this.value); + if (!note) return; notesName.value = note.name; notesText.value = note.legend; }