From 8c445f9a4065dc118330e0fefaeca928caa85c4c Mon Sep 17 00:00:00 2001 From: Emile Date: Thu, 7 Sep 2023 16:00:27 +0200 Subject: [PATCH] fix: Crashes when handling supercharging properties --- manifest.json | 2 +- src/linkAttributes/linkAttributes.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index be1458c..1691539 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "supercharged-links-obsidian", "name": "Supercharged Links", - "version": "0.10.0", + "version": "0.10.2", "minAppVersion": "1.4.0", "description": "Add properties and menu options to links and style them!", "author": "mdelobelle & Emile", diff --git a/src/linkAttributes/linkAttributes.ts b/src/linkAttributes/linkAttributes.ts index 3af26b3..da67428 100644 --- a/src/linkAttributes/linkAttributes.ts +++ b/src/linkAttributes/linkAttributes.ts @@ -146,6 +146,9 @@ export function updatePropertiesPane(propertiesEl: HTMLElement, file: TFile, app const key = keyEl.value; const listOfLinks: [string] = frontmatter[key]; let foundS = null; + if (!listOfLinks) { + continue; + } for (const s of listOfLinks) { if (s.length > 4 && s.startsWith("[[") && s.endsWith("]]")) { const slicedS = s.slice(2, -2); @@ -171,6 +174,9 @@ export function updatePropertiesPane(propertiesEl: HTMLElement, file: TFile, app // @ts-ignore const key = keyEl.value; const link: string = frontmatter[key]; + if (!link) { + continue; + } let foundS: string = null; if (link.length > 4 && link.startsWith("[[") && link.endsWith("]]")) { const slicedS = link.slice(2, -2);