From ff243582694c85289ef0b444cdc398d3ea227ec3 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 29 Aug 2022 15:40:38 +0200 Subject: [PATCH] Fixes #62 --- packages/plugs/core/navigate.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/plugs/core/navigate.ts b/packages/plugs/core/navigate.ts index 2f6f5239..88f4c954 100644 --- a/packages/plugs/core/navigate.ts +++ b/packages/plugs/core/navigate.ts @@ -1,5 +1,6 @@ import type { ClickEvent } from "@silverbulletmd/web/app_event"; import { + flashNotification, getCursor, getText, navigate as navigateTo, @@ -28,7 +29,11 @@ async function actionClickOrActionEnter(mdTree: ParseTree | null) { await openUrl(mdTree.children![0].text!); break; case "Link": - await openUrl(mdTree.children![4].children![0].text!); + const url = mdTree.children![4].children![0].text!; + if (url.length <= 1) { + return flashNotification("Empty link, ignoring", "error"); + } + await openUrl(url); break; case "CommandLink": let command = mdTree