Added additional check so that no errors would be thrown when no notes are present

This commit is contained in:
Mindaugas Vasiliauskas 2020-02-14 16:44:04 +02:00
parent 1dbb6ca677
commit 4bc646072c

View file

@ -53,12 +53,14 @@ function editNotes(id, name) {
function changeName() { function changeName() {
const id = document.getElementById("notesSelect").value; const id = document.getElementById("notesSelect").value;
const note = notes.find(note => note.id === id); const note = notes.find(note => note.id === id);
if (!note) return;
note.name = this.value; note.name = this.value;
} }
function changeText() { function changeText() {
const id = document.getElementById("notesSelect").value; const id = document.getElementById("notesSelect").value;
const note = notes.find(note => note.id === id); const note = notes.find(note => note.id === id);
if (!note) return;
note.legend = this.value; note.legend = this.value;
} }