From 1d3608b7bf85a897555ced11886fcc3c9ba8c6e8 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 3 Jan 2020 09:04:38 +0100 Subject: [PATCH] fix recent note dialog for deleted notes --- src/public/javascripts/services/link.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/public/javascripts/services/link.js b/src/public/javascripts/services/link.js index c1f74bf9a..22af09098 100644 --- a/src/public/javascripts/services/link.js +++ b/src/public/javascripts/services/link.js @@ -35,13 +35,15 @@ async function createNoteLink(notePath, options = {}) { if (showNotePath) { notePath = await treeService.resolveNotePath(notePath); - const noteIds = notePath.split("/"); - noteIds.pop(); // remove last element + if (notePath) { + const noteIds = notePath.split("/"); + noteIds.pop(); // remove last element - const parentNotePath = noteIds.join("/").trim(); + const parentNotePath = noteIds.join("/").trim(); - if (parentNotePath) { - $container.append($("").text(" (" + await treeUtils.getNotePathTitle(parentNotePath) + ")")); + if (parentNotePath) { + $container.append($("").text(" (" + await treeUtils.getNotePathTitle(parentNotePath) + ")")); + } } }